KWK25 commited on
Commit
edc77f2
·
verified ·
1 Parent(s): 1ebf236

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -28
app.py CHANGED
@@ -1,34 +1,16 @@
1
  import gradio as gr
2
- from huggingface_hub import InferenceClient
3
 
4
- client = InferenceClient("microsoft/phi-4")
5
-
6
- def respond(message, history):
7
-
8
- messages = [{
9
- "role": "system",
10
- "content": (
11
- "You are a friendly chatbot.")
12
- }]
13
-
14
- if history:
15
- messages.extend(history)
16
 
17
- messages.append({"role": "user", "content": message})
18
-
19
- response = client.chat_completion(
20
- messages,
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