vedarshatarun69 commited on
Commit
6a031ab
·
verified ·
1 Parent(s): 6c8dd0a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -1,10 +1,9 @@
1
  import gradio as gr
2
-
3
- # Use Hugging Face hosted inference API (no heavy model in the Space)
4
  import requests
5
 
6
  API_URL = "https://api-inference.huggingface.co/models/google/flan-t5-small"
7
- headers = {"Authorization": f"Bearer hf_XXXXXXXXXXXXXXXXXXXX"} # optional if public model
 
8
 
9
  def chat(message, history=[]):
10
  payload = {"inputs": message}
@@ -17,11 +16,10 @@ def chat(message, history=[]):
17
  history.append((message, reply))
18
  return history, history
19
 
20
- # Gradio UI
21
  with gr.Blocks() as demo:
22
- gr.Markdown("## 🤖 Permanent CPU-Friendly AI Chatbot")
23
  chat_ui = gr.Chatbot()
24
- msg = gr.Textbox(label="Type your message here")
25
  clear = gr.Button("Clear Chat")
26
 
27
  msg.submit(chat, [msg, chat_ui], [chat_ui, chat_ui])
 
1
  import gradio as gr
 
 
2
  import requests
3
 
4
  API_URL = "https://api-inference.huggingface.co/models/google/flan-t5-small"
5
+ # You can leave headers empty if model is public
6
+ headers = {}
7
 
8
  def chat(message, history=[]):
9
  payload = {"inputs": message}
 
16
  history.append((message, reply))
17
  return history, history
18
 
 
19
  with gr.Blocks() as demo:
20
+ gr.Markdown("## 🤖 Permanent AI Chatbot (CPU-Friendly)")
21
  chat_ui = gr.Chatbot()
22
+ msg = gr.Textbox(label="Type your message")
23
  clear = gr.Button("Clear Chat")
24
 
25
  msg.submit(chat, [msg, chat_ui], [chat_ui, chat_ui])