Spaces:
Runtime error
Runtime error
Commit
·
cc2590a
1
Parent(s):
4d06555
Update app.py
Browse files
app.py
CHANGED
@@ -76,16 +76,15 @@ def chatbot(chat_window, message, mode, model, hf_model, api_key):
|
|
76 |
# Define the Gradio interface for chatbot
|
77 |
chat_interface = gr.Interface(
|
78 |
fn=chatbot,
|
79 |
-
inputs=
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
),
|
89 |
outputs=output,
|
90 |
title="Chatbot",
|
91 |
description="Enter your message below to chat with an AI",
|
@@ -95,27 +94,5 @@ chat_interface = gr.Interface(
|
|
95 |
allow_share=False,
|
96 |
)
|
97 |
|
98 |
-
# Add a clear button to the chat window
|
99 |
-
clear_button = gr.Interface(
|
100 |
-
fn=lambda: chat_window.clear(),
|
101 |
-
inputs=None,
|
102 |
-
outputs=gr.outputs.Textbox(label="Chat history cleared."),
|
103 |
-
title="Clear Chat History",
|
104 |
-
description="Click to clear the chat history.",
|
105 |
-
theme="compact",
|
106 |
-
allow_flagging=False,
|
107 |
-
allow_screenshot=False,
|
108 |
-
allow_share=False,
|
109 |
-
)
|
110 |
-
|
111 |
-
# Combine the chat interface and clear button into a single page
|
112 |
-
page = gr.Interface(
|
113 |
-
[chat_interface, clear_button],
|
114 |
-
title="Chatbot",
|
115 |
-
description="Enter your message below to chat with an AI",
|
116 |
-
theme="compact",
|
117 |
-
layout="horizontal",
|
118 |
-
)
|
119 |
-
|
120 |
# Launch the page
|
121 |
-
|
|
|
76 |
# Define the Gradio interface for chatbot
|
77 |
chat_interface = gr.Interface(
|
78 |
fn=chatbot,
|
79 |
+
inputs=[
|
80 |
+
message_input,
|
81 |
+
mode_input,
|
82 |
+
model_input,
|
83 |
+
hf_model_input,
|
84 |
+
api_key_input,
|
85 |
+
gr.inputs.Button(label="Send"),
|
86 |
+
gr.inputs.Button(label="Clear Chat History")
|
87 |
+
],
|
|
|
88 |
outputs=output,
|
89 |
title="Chatbot",
|
90 |
description="Enter your message below to chat with an AI",
|
|
|
94 |
allow_share=False,
|
95 |
)
|
96 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
# Launch the page
|
98 |
+
chat_interface.launch()
|