Spaces:
Runtime error
Runtime error
Commit
·
51af174
1
Parent(s):
5546b26
apply chathmi3
Browse files
app.py
CHANGED
|
@@ -629,22 +629,45 @@ def LinkElement(chatbot_history):
|
|
| 629 |
pass
|
| 630 |
|
| 631 |
def chathmi3(message, history):
|
| 632 |
-
history = history + [(message, None)]
|
| 633 |
print("Input Message:", message)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 634 |
print("History: ", history)
|
| 635 |
print("-" * 20)
|
| 636 |
print("-" * 20)
|
| 637 |
-
|
| 638 |
|
| 639 |
|
| 640 |
with gr.Blocks() as demo:
|
| 641 |
# gr.Markdown("Start typing below and then click **SUBMIT** to see the output.")
|
| 642 |
-
main = gr.ChatInterface(
|
| 643 |
-
|
| 644 |
-
|
| 645 |
-
|
| 646 |
-
)
|
| 647 |
-
main.visible = False
|
| 648 |
|
| 649 |
with gr.Column() as main2:
|
| 650 |
title = gr.Markdown("""# <center> STLA BABY - YOUR FRIENDLY GUIDE
|
|
|
|
| 629 |
pass
|
| 630 |
|
| 631 |
def chathmi3(message, history):
|
|
|
|
| 632 |
print("Input Message:", message)
|
| 633 |
+
history = history + [(message, None)]
|
| 634 |
+
yield ["", history]
|
| 635 |
+
try:
|
| 636 |
+
response = agent.run(message)
|
| 637 |
+
time.sleep(0.1)
|
| 638 |
+
history = history + [(None, response)]
|
| 639 |
+
yield ["", history]
|
| 640 |
+
print ("response of chatbot:", response)
|
| 641 |
+
# real_content = response[-1:]
|
| 642 |
+
# print("real_content", real_content)
|
| 643 |
+
try:
|
| 644 |
+
temp = response.split("(sandbox:/")[1] # (sandbox:/sample-20230805-0807.wav)
|
| 645 |
+
file_name = temp.split(")")[0]
|
| 646 |
+
print("file_name:", file_name)
|
| 647 |
+
history = history + [((file_name,), None)]
|
| 648 |
+
yield ["", history]
|
| 649 |
+
except:
|
| 650 |
+
print("No need to add file in chatbot")
|
| 651 |
+
|
| 652 |
+
except Exception as e:
|
| 653 |
+
print("chathmi3 error:", e)
|
| 654 |
+
|
| 655 |
+
# history = history + [(message, None)]
|
| 656 |
+
|
| 657 |
print("History: ", history)
|
| 658 |
print("-" * 20)
|
| 659 |
print("-" * 20)
|
| 660 |
+
|
| 661 |
|
| 662 |
|
| 663 |
with gr.Blocks() as demo:
|
| 664 |
# gr.Markdown("Start typing below and then click **SUBMIT** to see the output.")
|
| 665 |
+
# main = gr.ChatInterface(
|
| 666 |
+
# chathmi2,
|
| 667 |
+
# title="STLA BABY - YOUR FRIENDLY GUIDE",
|
| 668 |
+
# description= "v0.3: Powered by MECH Core Team",
|
| 669 |
+
# )
|
| 670 |
+
# main.visible = False
|
| 671 |
|
| 672 |
with gr.Column() as main2:
|
| 673 |
title = gr.Markdown("""# <center> STLA BABY - YOUR FRIENDLY GUIDE
|