Medical-Bot / app.py
Sanchit2207's picture
Update app.py
224cd33 verified
raw
history blame
701 Bytes
from transformers import pipeline, Conversation
import gradio as gr
chatbot = pipeline(model="ContactDoctor/Bio-Medical-Llama-3-8B", task="conversational")
message_list = []
response_list = []
def Medical_Bot(message, history):
global message_list, response_list
message_list.append(message)
conversation = Conversation(text=message, past_user_inputs=message_list[:-1], generated_responses=response_list)
conversation = chatbot(conversation)
reply = conversation.generated_responses[-1]
response_list.append(reply)
return reply
demo_chatbot = gr.ChatInterface(Medical_Bot, title="Medical Bot", description="Enter text to start chatting.")
demo_chatbot.launch()