mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2024-12-19 04:17:52 +00:00
upgraded
This commit is contained in:
parent
5ef1a35224
commit
e2951eab6b
35
app.py
35
app.py
@ -22,7 +22,7 @@ main_repo = "https://github.com/ParisNeo/lollms-webui.git"
|
||||
import os
|
||||
import platform
|
||||
import sys
|
||||
from flask import request, jsonify
|
||||
from flask import request, jsonify, url_for
|
||||
import io
|
||||
import sys
|
||||
import time
|
||||
@ -33,7 +33,7 @@ from lollms.config import InstallOption
|
||||
from lollms.main_config import LOLLMSConfig
|
||||
from lollms.paths import LollmsPaths, gptqlora_repo
|
||||
from lollms.com import NotificationType, NotificationDisplayType
|
||||
from lollms.utilities import AdvancedGarbageCollector, reinstall_pytorch_with_cuda, convert_language_name, find_first_available_file_index, add_period
|
||||
from lollms.utilities import PackageManager, AdvancedGarbageCollector, reinstall_pytorch_with_cuda, convert_language_name, find_first_available_file_index, add_period
|
||||
lollms_paths = LollmsPaths.find_paths(force_local=True, custom_default_cfg_path="configs/config.yaml")
|
||||
# Configuration loading part
|
||||
config = LOLLMSConfig.autoload(lollms_paths)
|
||||
@ -518,6 +518,10 @@ try:
|
||||
"/execute_code", "execute_code", self.execute_code, methods=["POST"]
|
||||
)
|
||||
|
||||
self.add_endpoint(
|
||||
"/install_xtts", "install_xtts", self.install_xtts, methods=["GET"]
|
||||
)
|
||||
|
||||
self.add_endpoint(
|
||||
"/open_code_folder", "open_code_folder", self.open_code_folder, methods=["POST"]
|
||||
)
|
||||
@ -571,6 +575,15 @@ try:
|
||||
server_address = request.host_url
|
||||
return server_address
|
||||
|
||||
def install_xtts(self):
|
||||
try:
|
||||
self.ShowBlockingMessage("Installing xTTS api server\nPlease stand by")
|
||||
PackageManager.install_package("xtts-api-server")
|
||||
self.HideBlockingMessage()
|
||||
return jsonify({"status":True})
|
||||
except Exception as ex:
|
||||
self.HideBlockingMessage()
|
||||
return jsonify({"status":False, 'error':str(ex)})
|
||||
def execute_python(self, code, discussion_id, message_id):
|
||||
def spawn_process(code):
|
||||
"""Executes Python code and returns the output as JSON."""
|
||||
@ -637,12 +650,18 @@ try:
|
||||
pdflatex_command = self.config.pdf_latex_path
|
||||
else:
|
||||
pdflatex_command = 'pdflatex'
|
||||
|
||||
# Set the execution path to the folder containing the tmp_file
|
||||
execution_path = tmp_file.parent
|
||||
# Run the pdflatex command with the file path
|
||||
subprocess.run([pdflatex_command, tmp_file], check=True)
|
||||
|
||||
result = subprocess.run([pdflatex_command, "-interaction=nonstopmode", tmp_file], check=True, capture_output=True, text=True, cwd=execution_path)
|
||||
# Check the return code of the pdflatex command
|
||||
if result.returncode != 0:
|
||||
error_message = result.stderr.strip()
|
||||
execution_time = time.time() - start_time
|
||||
error_json = {"output": f"Error occurred while compiling LaTeX: {error_message}", "execution_time": execution_time}
|
||||
return json.dumps(error_json)
|
||||
# If the compilation is successful, you will get a PDF file
|
||||
pdf_file = pdflatex_command.with_suffix('.pdf')
|
||||
pdf_file = tmp_file.with_suffix('.pdf')
|
||||
print(f"PDF file generated: {pdf_file}")
|
||||
|
||||
except subprocess.CalledProcessError as e:
|
||||
@ -654,7 +673,9 @@ try:
|
||||
execution_time = time.time() - start_time
|
||||
|
||||
# The child process was successful.
|
||||
output_json = {"output": f"Pdf file generated at: {pdf_file}", "execution_time": execution_time}
|
||||
pdf_file=str(pdf_file)
|
||||
url = f"{url_for('main')[:-4]}{pdf_file[pdf_file.index('outputs'):]}"
|
||||
output_json = {"output": f"Pdf file generated at: {pdf_file}\n<a href='{url}'>Click here to show</a>", "execution_time": execution_time}
|
||||
return json.dumps(output_json)
|
||||
return spawn_process(code)
|
||||
|
||||
|
Binary file not shown.
@ -1 +1 @@
|
||||
Subproject commit 6d1189920683571c9df7954e41a00403ac020850
|
||||
Subproject commit ce44d0c87d3750bc61d6ada70491efb8e4c15bf6
|
8
web/dist/assets/index-ba9f58be.css
vendored
Normal file
8
web/dist/assets/index-ba9f58be.css
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
8
web/dist/assets/index-cefe48d9.css
vendored
8
web/dist/assets/index-cefe48d9.css
vendored
File diff suppressed because one or more lines are too long
4
web/dist/index.html
vendored
4
web/dist/index.html
vendored
@ -6,8 +6,8 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>LoLLMS WebUI - Welcome</title>
|
||||
<script type="module" crossorigin src="/assets/index-5caae1db.js"></script>
|
||||
<link rel="stylesheet" href="/assets/index-cefe48d9.css">
|
||||
<script type="module" crossorigin src="/assets/index-c1cddf3b.js"></script>
|
||||
<link rel="stylesheet" href="/assets/index-ba9f58be.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
@ -731,6 +731,16 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="min-width: 200px;">
|
||||
<label for="install_xtts_service" class="text-sm font-bold" style="margin-right: 1rem;">Reinstall xTTS service:</label>
|
||||
</td>
|
||||
<td>
|
||||
<div class="flex flex-row">
|
||||
<button class="hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center" @click="reinstallAudioService">Reinstall xtts service</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="min-width: 200px;">
|
||||
<label for="xtts_base_url" class="text-sm font-bold" style="margin-right: 1rem;">xtts base url:</label>
|
||||
</td>
|
||||
@ -1270,8 +1280,6 @@
|
||||
<!-- PERSONALITY ZOO -->
|
||||
<div
|
||||
class="flex flex-col mb-2 rounded-lg bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-bg-light-tone-panel hover:dark:bg-bg-dark-tone-panel duration-150 shadow-lg">
|
||||
|
||||
|
||||
<div class="flex flex-row p-3 items-center">
|
||||
<button @click.stop="pzc_collapsed = !pzc_collapsed"
|
||||
class="text-2xl hover:text-primary p-2 -m-2 text-left w-full flex items-center">
|
||||
@ -2009,6 +2017,15 @@ export default {
|
||||
//refreshHardwareUsage()
|
||||
},
|
||||
methods: {
|
||||
reinstallAudioService(){
|
||||
axios.get('install_xtts')
|
||||
.then(response => {
|
||||
|
||||
})
|
||||
.catch(error => {
|
||||
console.error(error);
|
||||
});
|
||||
},
|
||||
getSeviceVoices() {
|
||||
axios.get('list_voices')
|
||||
.then(response => {
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit d4bb8f243945b8987d715868a2b81cebb75b553e
|
||||
Subproject commit 8ca6f513073eaea1db4bcd09c8b41e9f8abe2cc2
|
Loading…
Reference in New Issue
Block a user