SHAILJA1 commited on
Commit
45f2521
·
verified ·
1 Parent(s): 54f12cf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -7
app.py CHANGED
@@ -1,7 +1,7 @@
1
  import gradio as gr
2
  from transformers import pipeline
3
 
4
- # Load a lightweight open-access model
5
  generator = pipeline("text-generation", model="tiiuae/falcon-7b-instruct", device_map="auto", max_new_tokens=200)
6
 
7
  def respond(message, chat_history):
@@ -11,16 +11,14 @@ def respond(message, chat_history):
11
  chat_history.append((message, response))
12
  return "", chat_history
13
 
14
- # Gradio Blocks interface with Submit button
15
  with gr.Blocks() as demo:
16
- gr.Markdown("## 🤖 Falcon-7B Chatbot with Submit Button")
17
- chatbot = gr.Chatbot(label="Chat")
18
  with gr.Row():
19
- msg = gr.Textbox(placeholder="Type your message here...", show_label=False, scale=8)
20
- submit = gr.Button("Submit", scale=2)
21
  state = gr.State([])
22
 
23
- # Bind submit button and Enter key
24
  submit.click(fn=respond, inputs=[msg, state], outputs=[msg, chatbot])
25
  msg.submit(fn=respond, inputs=[msg, state], outputs=[msg, chatbot])
26
 
 
1
  import gradio as gr
2
  from transformers import pipeline
3
 
4
+ # Load a general-purpose language model
5
  generator = pipeline("text-generation", model="tiiuae/falcon-7b-instruct", device_map="auto", max_new_tokens=200)
6
 
7
  def respond(message, chat_history):
 
11
  chat_history.append((message, response))
12
  return "", chat_history
13
 
14
+ # Minimal interface with no headings or model mention
15
  with gr.Blocks() as demo:
16
+ chatbot = gr.Chatbot()
 
17
  with gr.Row():
18
+ msg = gr.Textbox(placeholder="Type your message...", show_label=False, scale=8)
19
+ submit = gr.Button(value="Submit", scale=2)
20
  state = gr.State([])
21
 
 
22
  submit.click(fn=respond, inputs=[msg, state], outputs=[msg, chatbot])
23
  msg.submit(fn=respond, inputs=[msg, state], outputs=[msg, chatbot])
24