|
@@ -1,12 +1,11 @@
|
|
|
|
|
+import re
|
|
|
import time
|
|
import time
|
|
|
from pathlib import Path
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
import gradio as gr
|
|
import gradio as gr
|
|
|
-import torch
|
|
|
|
|
-import re
|
|
|
|
|
-
|
|
|
|
|
import modules.chat as chat
|
|
import modules.chat as chat
|
|
|
import modules.shared as shared
|
|
import modules.shared as shared
|
|
|
|
|
+import torch
|
|
|
|
|
|
|
|
torch._C._jit_set_profiling_mode(False)
|
|
torch._C._jit_set_profiling_mode(False)
|
|
|
|
|
|
|
@@ -47,7 +46,6 @@ def load_model():
|
|
|
model = load_model()
|
|
model = load_model()
|
|
|
|
|
|
|
|
def remove_surrounded_chars(string):
|
|
def remove_surrounded_chars(string):
|
|
|
- # regexp is way faster than repeated string concatenation!
|
|
|
|
|
# this expression matches to 'as few symbols as possible (0 upwards) between any asterisks' OR
|
|
# this expression matches to 'as few symbols as possible (0 upwards) between any asterisks' OR
|
|
|
# 'as few symbols as possible (0 upwards) between an asterisk and the end of the string'
|
|
# 'as few symbols as possible (0 upwards) between an asterisk and the end of the string'
|
|
|
return re.sub('\*[^\*]*?(\*|$)','',string)
|
|
return re.sub('\*[^\*]*?(\*|$)','',string)
|
|
@@ -163,4 +161,4 @@ def ui():
|
|
|
autoplay.change(lambda x: params.update({"autoplay": x}), autoplay, None)
|
|
autoplay.change(lambda x: params.update({"autoplay": x}), autoplay, None)
|
|
|
voice.change(lambda x: params.update({"speaker": x}), voice, None)
|
|
voice.change(lambda x: params.update({"speaker": x}), voice, None)
|
|
|
v_pitch.change(lambda x: params.update({"voice_pitch": x}), v_pitch, None)
|
|
v_pitch.change(lambda x: params.update({"voice_pitch": x}), v_pitch, None)
|
|
|
- v_speed.change(lambda x: params.update({"voice_speed": x}), v_speed, None)
|
|
|
|
|
|
|
+ v_speed.change(lambda x: params.update({"voice_speed": x}), v_speed, None)
|