Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,34 +1,16 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
from huggingface_hub import InferenceClient
|
| 3 |
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
"content": (
|
| 11 |
-
"You are a friendly chatbot.")
|
| 12 |
-
}]
|
| 13 |
-
|
| 14 |
-
if history:
|
| 15 |
-
messages.extend(history)
|
| 16 |
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
max_tokens=200
|
| 22 |
-
)
|
| 23 |
-
|
| 24 |
-
return response['choices'][0]['message']['content'].strip()
|
| 25 |
-
|
| 26 |
-
chatbot = gr.ChatInterface(
|
| 27 |
-
respond,
|
| 28 |
-
type="messages",
|
| 29 |
-
title="K-pop Chatbot"
|
| 30 |
-
)
|
| 31 |
|
| 32 |
-
chatbot.launch()
|
| 33 |
|
| 34 |
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
|
| 3 |
+
with gr.Blocks() as demo:
|
| 4 |
+
with gr.Row():
|
| 5 |
+
with gr.Column(scale=1): # Sidebar column (narrow)
|
| 6 |
+
gr.Markdown("## Sidebar")
|
| 7 |
+
btn_hello = gr.Button("Say Hello")
|
| 8 |
+
btn_clear = gr.Button("Clear Chat")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
+
with gr.Column(scale=4): # Chat area column (wide)
|
| 11 |
+
chatbot = gr.Chatbot()
|
| 12 |
+
user_input = gr.Textbox(placeholder="Type your message...")
|
| 13 |
+
send_btn = gr.Button("Send")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
|
|
|
| 15 |
|
| 16 |
|