mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2025-04-16 07:06:38 +00:00
upgraded
This commit is contained in:
parent
b8de88153f
commit
5ef1a35224
17
app.py
17
app.py
@ -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
|
||||
from lollms.utilities import 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)
|
||||
@ -499,7 +499,7 @@ try:
|
||||
)
|
||||
|
||||
self.add_endpoint(
|
||||
"/read", "read", self.read, methods=["POST"]
|
||||
"/text2Audio", "text2Audio", self.text2Audio, methods=["POST"]
|
||||
)
|
||||
|
||||
self.add_endpoint(
|
||||
@ -646,7 +646,9 @@ try:
|
||||
print(f"PDF file generated: {pdf_file}")
|
||||
|
||||
except subprocess.CalledProcessError as e:
|
||||
print(f"Error occurred while compiling LaTeX: {e}")
|
||||
self.error(f"Error occurred while compiling LaTeX: {e}")
|
||||
error_json = {"output": "<div class='text-red-500'>"+str(ex)+"\n"+get_trace_exception(ex)+"</div>", "execution_time": execution_time}
|
||||
return json.dumps(error_json)
|
||||
|
||||
# Stop the timer.
|
||||
execution_time = time.time() - start_time
|
||||
@ -826,7 +828,10 @@ try:
|
||||
self.config.save_config()
|
||||
return jsonify({"status":True})
|
||||
|
||||
def read(self):
|
||||
|
||||
|
||||
|
||||
def text2Audio(self):
|
||||
# Get the JSON data from the POST request.
|
||||
try:
|
||||
from lollms.audio_gen_modules.lollms_xtts import LollmsXTTS
|
||||
@ -853,7 +858,9 @@ try:
|
||||
voices_folder = Path(__file__).parent/"voices"
|
||||
self.tts.set_speaker_folder(voices_folder)
|
||||
url = f"audio/{output_fn}"
|
||||
self.tts.tts_to_file(data['text'], f"{voice}.wav", f"{output_fn}", language=language)
|
||||
preprocessed_text= add_period(data['text'])
|
||||
|
||||
self.tts.tts_to_file(preprocessed_text, f"{voice}.wav", f"{output_fn}", language=language)
|
||||
self.info("Voice file ready")
|
||||
return jsonify({"url": url})
|
||||
except:
|
||||
|
0
latex_file_849.aux
Normal file
0
latex_file_849.aux
Normal file
BIN
latex_file_849.pdf
Normal file
BIN
latex_file_849.pdf
Normal file
Binary file not shown.
@ -1 +1 @@
|
||||
Subproject commit a2cf0dbf501cd5ff2a381d5aea0934e91666424a
|
||||
Subproject commit 6d1189920683571c9df7954e41a00403ac020850
|
File diff suppressed because one or more lines are too long
2
web/dist/index.html
vendored
2
web/dist/index.html
vendored
@ -6,7 +6,7 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>LoLLMS WebUI - Welcome</title>
|
||||
<script type="module" crossorigin src="/assets/index-c32bc922.js"></script>
|
||||
<script type="module" crossorigin src="/assets/index-5caae1db.js"></script>
|
||||
<link rel="stylesheet" href="/assets/index-cefe48d9.css">
|
||||
</head>
|
||||
<body>
|
||||
|
@ -8,10 +8,11 @@
|
||||
<i data-feather="copy"></i>
|
||||
</button>
|
||||
<button v-if="['python', 'sh', 'shell', 'bash', 'cmd', 'powershell', 'latex'].includes(language)" ref="btn_code_exec" @click="executeCode" title="execute"
|
||||
class="px-2 py-1 ml-2 text-left p-2 text-sm font-medium bg-bg-dark-tone-panel dark:bg-bg-dark-tone rounded-lg hover:bg-primary dark:hover:bg-primary text-white text-xs transition-colors duration-200">
|
||||
class="px-2 py-1 ml-2 text-left p-2 text-sm font-medium bg-bg-dark-tone-panel dark:bg-bg-dark-tone rounded-lg hover:bg-primary dark:hover:bg-primary text-white text-xs transition-colors duration-200"
|
||||
:class="isExecuting?'bg-green-500':''">
|
||||
<i data-feather="play-circle"></i>
|
||||
</button>
|
||||
<button v-if="['python'].includes(language)" @click="openFolder" title="open code project folder"
|
||||
<button v-if="['python', 'latex'].includes(language)" @click="openFolder" title="open code project folder"
|
||||
class="px-2 py-1 ml-2 text-left p-2 text-sm font-medium bg-bg-dark-tone-panel dark:bg-bg-dark-tone rounded-lg hover:bg-primary dark:hover:bg-primary text-white text-xs transition-colors duration-200">
|
||||
<i data-feather="folder"></i>
|
||||
</button>
|
||||
@ -76,6 +77,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isExecuting:false,
|
||||
isCopied: false,
|
||||
executionOutput: '', // new property
|
||||
};
|
||||
@ -132,13 +134,20 @@ export default {
|
||||
})
|
||||
},
|
||||
executeCode() {
|
||||
const json = JSON.stringify({ 'code': this.code, 'discussion_id': this.discussion_id, 'message_id': this.message_id, 'language': this.language})
|
||||
this.isExecuting=true;
|
||||
const json = JSON.stringify({
|
||||
'code': this.code,
|
||||
'discussion_id': this.discussion_id,
|
||||
'message_id': this.message_id,
|
||||
'language': this.language
|
||||
})
|
||||
console.log(json)
|
||||
fetch(`${this.host}/execute_code`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: json
|
||||
}).then(response=>{
|
||||
this.isExecuting=false;
|
||||
// Parse the JSON data from the response body
|
||||
return response.json();
|
||||
})
|
||||
@ -148,6 +157,7 @@ export default {
|
||||
this.executionOutput = jsonData.output;
|
||||
})
|
||||
.catch(error => {
|
||||
this.isExecuting=false;
|
||||
// Handle any errors that occurred during the fetch process
|
||||
console.error('Fetch error:', error);
|
||||
});
|
||||
|
@ -368,7 +368,7 @@ export default {
|
||||
}
|
||||
else{
|
||||
this.isSynthesizingVoice=true
|
||||
axios.post("./read",{text:this.message.content}).then(response => {
|
||||
axios.post("./text2Audio",{text:this.message.content}).then(response => {
|
||||
let url = response.data.url
|
||||
console.log(url)
|
||||
this.audio_url = url
|
||||
|
@ -573,7 +573,7 @@ export default {
|
||||
},
|
||||
read(){
|
||||
this.isSynthesizingVoice=true
|
||||
axios.post("./read",{text:this.text}).then(response => {
|
||||
axios.post("./text2Audio",{text:this.text}).then(response => {
|
||||
console.log(response.data.url)
|
||||
let url = response.data.url
|
||||
this.audio_url = bUrl+url
|
||||
|
Loading…
x
Reference in New Issue
Block a user