akhaliq HF Staff commited on
Commit
3f116b6
·
verified ·
1 Parent(s): 4f781fd

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. app.py +31 -0
  2. requirements.txt +7 -0
app.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ def chatbot(input_text, history=[]):
4
+ if not input_text:
5
+ return history, ""
6
+ history = history + [f"User: {input_text}"]
7
+ response = f"You said: {input_text}" # Simple response
8
+ history = history + [f"Bot: {response}"]
9
+ return history, ""
10
+
11
+ with gr.Blocks() as demo:
12
+ gr.Markdown("# Simple Chatbot\nBuilt with anycoder")
13
+ chatbot_ui = gr.Chatbot()
14
+ input_box = gr.Textbox(placeholder="Type your message...", label="Message")
15
+ with gr.Row():
16
+ send_btn = gr.Button("Send", variant="primary")
17
+ clear_btn = gr.Button("Clear")
18
+
19
+ send_btn.click(chatbot, [input_box, chatbot_ui], [chatbot_ui, input_box])
20
+ clear_btn.click(lambda: ("", []), [], [chatbot_ui, input_box])
21
+
22
+ if __name__ == "__main__":
23
+ demo.launch()
24
+ This chatbot application includes:
25
+ - **Modern Interface**: Clean chat UI with chatbot component
26
+ - **Interactive Controls**: Send and clear buttons
27
+ - **State Management**: Maintains conversation history
28
+ - **User-Friendly**: Clear labels and placeholder text
29
+ - **Attribution**: "Built with anycoder" link as requested
30
+
31
+ The chatbot currently echoes user messages. You can easily extend the `chatbot` function to integrate with any LLM API or language model for more sophisticated responses.
requirements.txt ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ gradio
2
+ requests
3
+ Pillow
4
+ numpy
5
+ pandas
6
+ matplotlib
7
+ plotly