Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import random
|
3 |
+
import time
|
4 |
+
|
5 |
+
# Use a pipeline as a high-level helper
|
6 |
+
from transformers import pipeline
|
7 |
+
|
8 |
+
pipe = pipeline("conversational", model="llSourcell/medllama2_7b")
|
9 |
+
|
10 |
+
with gr.Blocks() as demo:
|
11 |
+
chatbot = gr.Chatbot()
|
12 |
+
msg = gr.Textbox()
|
13 |
+
clear = gr.ClearButton([msg, chatbot])
|
14 |
+
|
15 |
+
def respond(message, chat_history):
|
16 |
+
bot_message = pipe(message)
|
17 |
+
chat_history.append((message, bot_message))
|
18 |
+
time.sleep(2)
|
19 |
+
return "", chat_history
|
20 |
+
|
21 |
+
msg.submit(respond, [msg, chatbot], [msg, chatbot])
|
22 |
+
|
23 |
+
demo.launch()
|