Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
import gradio as gr
|
3 |
+
import time
|
4 |
+
|
5 |
+
def simple_chat_function(message, history):
|
6 |
+
"""Simplified chat function for testing"""
|
7 |
+
if not message.strip():
|
8 |
+
return "", history
|
9 |
+
|
10 |
+
# Your response generation logic here
|
11 |
+
response = f"You asked: {message}" # Replace with your actual logic
|
12 |
+
|
13 |
+
# Add to history
|
14 |
+
history.append([message, response])
|
15 |
+
|
16 |
+
return "", history
|
17 |
+
|
18 |
+
# Minimal working interface
|
19 |
+
with gr.Blocks() as demo:
|
20 |
+
chatbot = gr.Chatbot()
|
21 |
+
msg = gr.Textbox(placeholder="Type your message here...")
|
22 |
+
clear = gr.Button("Clear")
|
23 |
+
|
24 |
+
msg.submit(simple_chat_function, [msg, chatbot], [msg, chatbot])
|
25 |
+
clear.click(lambda: ([], ""), outputs=[chatbot, msg])
|
26 |
+
|
27 |
+
if __name__ == "__main__":
|
28 |
+
demo.launch()
|