Spaces:
Build error
Build error
gorkemgoknar
commited on
Commit
•
0d5cdcd
1
Parent(s):
8bbb21f
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,7 +127,9 @@ def greet(character,your_voice,message,history):
|
|
127 |
|
128 |
|
129 |
response = get_chat_response(character,history=history["message_history"],input_txt=message)
|
130 |
-
|
|
|
|
|
131 |
os.system('tts --text "'+response+'" --model_name tts_models/multilingual/multi-dataset/your_tts --speaker_wav '+your_voice+' --language_idx "en"')
|
132 |
|
133 |
history["message_history"].append((message, response))
|
@@ -169,7 +171,7 @@ examples=[['Gandalf','Hello','dragon.wav']]
|
|
169 |
|
170 |
history = {"character": "None", "message_history" : [] }
|
171 |
interface= gr.Interface(fn=greet,
|
172 |
-
inputs=[gr.inputs.Dropdown(personality_choices),gr.inputs.Audio(source="microphone", type="filepath") ,"text", "state"],
|
173 |
outputs=[gr.outputs.Audio(type="file"),"html","state"],
|
174 |
css=css, title=title, description=description,article=article )
|
175 |
|
|
|
114 |
|
115 |
|
116 |
|
117 |
+
def greet(character,your_voice,voice_file,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 |
+
if voice_file is not None:
|
131 |
+
your_voice = voice_file
|
132 |
+
|
133 |
os.system('tts --text "'+response+'" --model_name tts_models/multilingual/multi-dataset/your_tts --speaker_wav '+your_voice+' --language_idx "en"')
|
134 |
|
135 |
history["message_history"].append((message, response))
|
|
|
171 |
|
172 |
history = {"character": "None", "message_history" : [] }
|
173 |
interface= gr.Interface(fn=greet,
|
174 |
+
inputs=[gr.inputs.Dropdown(personality_choices),gr.inputs.Audio(source="microphone", type="filepath") ,gr.inputs.Audio("filepath"),"text", "state"],
|
175 |
outputs=[gr.outputs.Audio(type="file"),"html","state"],
|
176 |
css=css, title=title, description=description,article=article )
|
177 |
|