Spaces:
Build error
Build error
Commit
·
8d391eb
1
Parent(s):
9119926
Update app.py
Browse files
app.py
CHANGED
@@ -114,7 +114,7 @@ MODEL_NAME= "tts_models/multilingual/multi-dataset/your_tts"
|
|
114 |
|
115 |
|
116 |
|
117 |
-
def greet(character,your_voice,message,history):
|
118 |
|
119 |
#gradios set_state/get_state had problems on embedded html!
|
120 |
history = history or {"character": character, "message_history" : [] }
|
@@ -127,6 +127,10 @@ def greet(character,your_voice,message,history):
|
|
127 |
|
128 |
|
129 |
response = get_chat_response(character,history=history["message_history"],input_txt=message)
|
|
|
|
|
|
|
|
|
130 |
os.system('tts --text "'+response+'" --model_name tts_models/multilingual/multi-dataset/your_tts --speaker_wav '+your_voice+' --language_idx "en"')
|
131 |
|
132 |
history["message_history"].append((message, response))
|
@@ -168,7 +172,7 @@ examples=[['Gandalf','Hello','dragon.wav']]
|
|
168 |
|
169 |
history = {"character": "None", "message_history" : [] }
|
170 |
interface= gr.Interface(fn=greet,
|
171 |
-
inputs=[gr.inputs.Dropdown(personality_choices),gr.inputs.Audio(source="microphone", type="filepath") ,"text", "state"],
|
172 |
outputs=[gr.outputs.Audio(type="file"),"html","state"],
|
173 |
css=css, title=title, description=description,article=article )
|
174 |
|
|
|
114 |
|
115 |
|
116 |
|
117 |
+
def greet(character,your_voice,other_voice,message,history):
|
118 |
|
119 |
#gradios set_state/get_state had problems on embedded html!
|
120 |
history = history or {"character": character, "message_history" : [] }
|
|
|
127 |
|
128 |
|
129 |
response = get_chat_response(character,history=history["message_history"],input_txt=message)
|
130 |
+
|
131 |
+
if other_voice is not None:
|
132 |
+
your_voice = other_voice
|
133 |
+
|
134 |
os.system('tts --text "'+response+'" --model_name tts_models/multilingual/multi-dataset/your_tts --speaker_wav '+your_voice+' --language_idx "en"')
|
135 |
|
136 |
history["message_history"].append((message, response))
|
|
|
172 |
|
173 |
history = {"character": "None", "message_history" : [] }
|
174 |
interface= gr.Interface(fn=greet,
|
175 |
+
inputs=[gr.inputs.Dropdown(personality_choices),gr.inputs.Audio(source="microphone", type="filepath") ,gr.inputs.Audio(type="filepath"),"text", "state"],
|
176 |
outputs=[gr.outputs.Audio(type="file"),"html","state"],
|
177 |
css=css, title=title, description=description,article=article )
|
178 |
|