rahul2001's picture
Update app.py
ad70a31
raw
history blame
645 Bytes
import gradio as gr
import random
import time
# Use a pipeline as a high-level helper
# Use a pipeline as a high-level helper
from transformers import pipeline
print("loading model")
pipe = pipeline("conversational", model="llSourcell/medllama2_7b")
print("load model")
with gr.Blocks() as demo:
chatbot = gr.Chatbot()
msg = gr.Textbox()
clear = gr.ClearButton([msg, chatbot])
def respond(message, chat_history):
bot_message = pipe(message)
chat_history.append((message, bot_message))
time.sleep(2)
return "", chat_history
msg.submit(respond, [msg, chatbot], [msg, chatbot])
demo.launch()