Spaces:
Runtime error
Runtime error
Commit
·
24f1cbd
1
Parent(s):
8a383d3
correct defect in retry
Browse files
app.py
CHANGED
@@ -680,7 +680,30 @@ def clearall():
|
|
680 |
def retry(chatbot_history):
|
681 |
global last_request
|
682 |
print("last_request", last_request)
|
683 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
684 |
|
685 |
with gr.Blocks() as demo:
|
686 |
# gr.Markdown("Start typing below and then click **SUBMIT** to see the output.")
|
@@ -710,14 +733,14 @@ with gr.Blocks() as demo:
|
|
710 |
agentchoice = gr.Dropdown(
|
711 |
choices=['Zero Short Agent','Zero Short React','OpenAI Multi'],
|
712 |
label="SELECT AI AGENT",
|
713 |
-
scale= 1
|
714 |
show_label = True,
|
715 |
value="Zero Short Agent",
|
716 |
)
|
717 |
voice_input = gr.Audio(
|
718 |
source="microphone",
|
719 |
type="filepath",
|
720 |
-
scale= 1
|
721 |
label= "INPUT",
|
722 |
)
|
723 |
voice_output = gr.Audio(
|
|
|
680 |
def retry(chatbot_history):
|
681 |
global last_request
|
682 |
print("last_request", last_request)
|
683 |
+
message = last_request
|
684 |
+
history = history + [(message, None)]
|
685 |
+
yield [history]
|
686 |
+
|
687 |
+
try:
|
688 |
+
response = agent.run(message)
|
689 |
+
time.sleep(0.1)
|
690 |
+
history = history + [(None, response)]
|
691 |
+
yield [history]
|
692 |
+
print ("response of chatbot:", response)
|
693 |
+
# real_content = response[-1:]
|
694 |
+
# print("real_content", real_content)
|
695 |
+
try:
|
696 |
+
temp = response.split("(sandbox:/")[1] # (sandbox:/sample-20230805-0807.wav)
|
697 |
+
file_name = temp.split(")")[0]
|
698 |
+
print("file_name:", file_name)
|
699 |
+
history = history + [(None, (file_name,))]
|
700 |
+
yield [history]
|
701 |
+
except:
|
702 |
+
print("No need to add file in chatbot")
|
703 |
+
|
704 |
+
except Exception as e:
|
705 |
+
print("chathmi3 error:", e)
|
706 |
+
# yield chathmi3(last_request, chatbot_history)
|
707 |
|
708 |
with gr.Blocks() as demo:
|
709 |
# gr.Markdown("Start typing below and then click **SUBMIT** to see the output.")
|
|
|
733 |
agentchoice = gr.Dropdown(
|
734 |
choices=['Zero Short Agent','Zero Short React','OpenAI Multi'],
|
735 |
label="SELECT AI AGENT",
|
736 |
+
scale= 1,
|
737 |
show_label = True,
|
738 |
value="Zero Short Agent",
|
739 |
)
|
740 |
voice_input = gr.Audio(
|
741 |
source="microphone",
|
742 |
type="filepath",
|
743 |
+
scale= 1,
|
744 |
label= "INPUT",
|
745 |
)
|
746 |
voice_output = gr.Audio(
|