Spaces:
Build error
Build error
Commit
·
9d62c6e
1
Parent(s):
4f05fae
Update app.py
Browse files
app.py
CHANGED
@@ -187,7 +187,7 @@ def greet(character,your_voice,message,history):
|
|
187 |
|
188 |
|
189 |
|
190 |
-
def greet_stt_to_tts(character,your_voice,history):
|
191 |
|
192 |
#gradios set_state/get_state had problems on embedded html!
|
193 |
history = history or {"character": character, "message_history" : [] }
|
@@ -208,8 +208,12 @@ def greet_stt_to_tts(character,your_voice,history):
|
|
208 |
# only get first
|
209 |
response = response[0]
|
210 |
print("Response only first:",response)
|
211 |
-
|
212 |
-
|
|
|
|
|
|
|
|
|
213 |
|
214 |
history["message_history"].append((message, response))
|
215 |
|
@@ -276,15 +280,16 @@ examples=[['Gandalf','dragon.wav','Who are you sir?',{}]]
|
|
276 |
|
277 |
history = {"character": "None", "message_history" : [] }
|
278 |
|
|
|
279 |
interface_full = gr.Interface(fn=greet_stt_to_tts,
|
280 |
inputs=[gr.Dropdown(personality_choices),
|
281 |
-
gr.Audio(source="microphone", type="filepath", label="Record Audio") ,
|
282 |
-
"
|
|
|
283 |
outputs=["html","state",gr.Audio(type="filepath")],
|
284 |
css=css, title="Chat with Your Voice", description=description,article=article ,
|
285 |
live=False)
|
286 |
|
287 |
-
|
288 |
interface_mic = gr.Interface(fn=greet,
|
289 |
inputs=[gr.Dropdown(personality_choices),
|
290 |
gr.Audio(source="microphone", type="filepath") ,
|
|
|
187 |
|
188 |
|
189 |
|
190 |
+
def greet_stt_to_tts(character,your_voice,chat_audio,history,use_your_voice_as_output):
|
191 |
|
192 |
#gradios set_state/get_state had problems on embedded html!
|
193 |
history = history or {"character": character, "message_history" : [] }
|
|
|
208 |
# only get first
|
209 |
response = response[0]
|
210 |
print("Response only first:",response)
|
211 |
+
|
212 |
+
if use_your_voice_as_output:
|
213 |
+
os.system('tts --text "'+response+'" --model_name tts_models/multilingual/multi-dataset/your_tts --speaker_wav '+your_voice+' --language_idx "en"')
|
214 |
+
else:
|
215 |
+
os.system('tts --text "'+response+'" --model_name tts_models/multilingual/multi-dataset/your_tts --speaker_wav '+chat_audio+' --language_idx "en"')
|
216 |
+
|
217 |
|
218 |
history["message_history"].append((message, response))
|
219 |
|
|
|
280 |
|
281 |
history = {"character": "None", "message_history" : [] }
|
282 |
|
283 |
+
|
284 |
interface_full = gr.Interface(fn=greet_stt_to_tts,
|
285 |
inputs=[gr.Dropdown(personality_choices),
|
286 |
+
gr.Audio(source="microphone", type="filepath", label="Record Audio for STT") ,
|
287 |
+
gr.Audio(type="filepath", label="Character Audio Voice Reference"),
|
288 |
+
"state", gr.Checkbox(label="Use Your Microphone for chatGPT Voice?", value=False)],
|
289 |
outputs=["html","state",gr.Audio(type="filepath")],
|
290 |
css=css, title="Chat with Your Voice", description=description,article=article ,
|
291 |
live=False)
|
292 |
|
|
|
293 |
interface_mic = gr.Interface(fn=greet,
|
294 |
inputs=[gr.Dropdown(personality_choices),
|
295 |
gr.Audio(source="microphone", type="filepath") ,
|