Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -85,14 +85,32 @@ example1 = [
|
|
85 |
["What from Beijing to New York?"]
|
86 |
]
|
87 |
|
88 |
-
# Create the Gradio interface
|
89 |
-
interface = gr.ChatInterface(
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
|
97 |
-
|
98 |
-
interface.launch()
|
|
|
85 |
["What from Beijing to New York?"]
|
86 |
]
|
87 |
|
88 |
+
# # Create the Gradio interface
|
89 |
+
# interface = gr.ChatInterface(
|
90 |
+
# fn=generate_response,
|
91 |
+
# chatbot=gr.Chatbot(show_label=False, show_share_button=False, show_copy_button=True, likeable=True, layout="panel"),
|
92 |
+
# additional_inputs=additional_inputs,
|
93 |
+
# examples=example1,
|
94 |
+
# cache_examples=False,
|
95 |
+
# )
|
96 |
+
|
97 |
+
# # Launch the app
|
98 |
+
# interface.launch()
|
99 |
+
|
100 |
+
def clear_chat():
|
101 |
+
# print("Clear chat history")
|
102 |
+
memory.clear()
|
103 |
+
return None
|
104 |
+
|
105 |
+
with gr.Blocks(fill_width=True, fill_height=True) as demo:
|
106 |
+
gr.ChatInterface(
|
107 |
+
fn=generate_response,
|
108 |
+
chatbot=gr.Chatbot(show_label=False, show_share_button=False, show_copy_button=True, likeable=True, layout="panel"),
|
109 |
+
additional_inputs=additional_inputs,
|
110 |
+
examples=example1,
|
111 |
+
cache_examples=False,
|
112 |
+
)
|
113 |
+
clear_button = gr.Button("Clear chat history and Start a new chat")
|
114 |
+
clear_button.click(clear_chat, inputs=None, outputs=None)
|
115 |
|
116 |
+
demo.launch()
|
|