demo_medical_QA / app.py
zerostratos's picture
Update app.py
b05a407 verified
raw
history blame
720 Bytes
import gradio as gr
from llama_cpp import Llama
# Load the model
llm = Llama.from_pretrained(
repo_id="Viet-Mistral/Vistral-7B-Chat",
# filename="models-7B-F16.gguf"
)
# Define the function to interact with the model
def chat_with_model(user_input):
response = llm.create_chat_completion(
messages=[
{"role": "user", "content": user_input}
]
)
return response['choices'][0]['message']['content']
# Create the Gradio interface
iface = gr.Interface(
fn=chat_with_model,
inputs="text",
outputs="text",
title="QA-medical Chatbot",
description="Ask the model any medical question !"
)
# Launch the interface
if __name__ == "__main__":
iface.launch()