Spaces:
Runtime error
Runtime error
splitting file name to fetch from local
Browse files
app.py
CHANGED
@@ -34,6 +34,8 @@ def fill_input_textbox(history, audio):
|
|
34 |
trimmed_response = response.split("SOURCES:")[0]
|
35 |
myobj = gTTS(text=trimmed_response, lang='en', slow=False)
|
36 |
myobj.save("response.wav")
|
|
|
|
|
37 |
audio = audio + ".wav"
|
38 |
history = history + [((audio, ), ('response.wav', ))]
|
39 |
print(history)
|
@@ -62,7 +64,7 @@ with gr.Blocks() as demo:
|
|
62 |
|
63 |
audio.change(fn=fill_input_textbox,inputs=[chatbot, audio], outputs=[chatbot]).then(
|
64 |
bot, chatbot, chatbot
|
65 |
-
)
|
66 |
|
67 |
if __name__ == "__main__":
|
68 |
demo.launch()
|
|
|
34 |
trimmed_response = response.split("SOURCES:")[0]
|
35 |
myobj = gTTS(text=trimmed_response, lang='en', slow=False)
|
36 |
myobj.save("response.wav")
|
37 |
+
# split audio by / and keep the last element
|
38 |
+
audio = audio.split("/")[-1]
|
39 |
audio = audio + ".wav"
|
40 |
history = history + [((audio, ), ('response.wav', ))]
|
41 |
print(history)
|
|
|
64 |
|
65 |
audio.change(fn=fill_input_textbox,inputs=[chatbot, audio], outputs=[chatbot]).then(
|
66 |
bot, chatbot, chatbot
|
67 |
+
).trigger("clear")
|
68 |
|
69 |
if __name__ == "__main__":
|
70 |
demo.launch()
|