Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
-
# Load a
|
| 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 |
-
#
|
| 15 |
with gr.Blocks() as demo:
|
| 16 |
-
gr.
|
| 17 |
-
chatbot = gr.Chatbot(label="Chat")
|
| 18 |
with gr.Row():
|
| 19 |
-
msg = gr.Textbox(placeholder="Type your message
|
| 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 |
|