Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from utils import generate_response
|
3 |
+
|
4 |
+
# Define chatbot interaction function
|
5 |
+
def chat(user_input):
|
6 |
+
response = generate_response(user_input)
|
7 |
+
return response
|
8 |
+
|
9 |
+
# Create Gradio interface
|
10 |
+
with gr.Blocks() as demo:
|
11 |
+
gr.Markdown("## 🤖 Professional Groq Chatbot")
|
12 |
+
gr.Markdown("Type your message below and chat with the AI!")
|
13 |
+
|
14 |
+
with gr.Row():
|
15 |
+
user_input = gr.Textbox(
|
16 |
+
label="Your Message",
|
17 |
+
placeholder="Ask me anything!",
|
18 |
+
lines=2,
|
19 |
+
)
|
20 |
+
submit_button = gr.Button("Send")
|
21 |
+
|
22 |
+
chatbot_output = gr.Textbox(
|
23 |
+
label="Response",
|
24 |
+
placeholder="AI's response will appear here.",
|
25 |
+
lines=6,
|
26 |
+
interactive=False,
|
27 |
+
)
|
28 |
+
|
29 |
+
submit_button.click(fn=chat, inputs=[user_input], outputs=[chatbot_output])
|
30 |
+
|
31 |
+
# Launch locally
|
32 |
+
if __name__ == "__main__":
|
33 |
+
demo.launch()
|