Testinggrounds / app.py
sjdata's picture
Fixed application file
8d9cdc9
raw
history blame
No virus
1.02 kB
import gradio as gr
from huggingface_hub import hf_hub_download
hf_hub_download(repo_id="LLukas22/gpt4all-lora-quantized-ggjt", filename="ggjt-model.bin", local_dir=".")
from pyllamacpp.model import Model
llm = Model(ggml_model="ggjt-model.bin", n_ctx=2000)
fixed_instruction = "You are a healthcare bot designed to give advice for the prevention and treatment of various illnesses."
def respond(message):
full_instruction = fixed_instruction + " " + message
bot_message = llm(full_instruction, stop=['### Instruction:', '### End'])
bot_message = bot_message['choices'][0]['text']
return bot_message
gr.ChatInterface(
fn=respond,
chatbot=gr.Chatbot(height=300),
textbox=gr.Textbox(placeholder="Ask me a question"),
title="Healthcare Bot",
description="Ask the Healthcare Bot any question",
examples = [
"Give me treatements for heart disease",
"I hate excercise, what else can I do to treat my high blood pressure",
"How can I avoid lung disease",
],
).launch()