File size: 1,020 Bytes
7a5420b
7617af6
7a5420b
7617af6
7a5420b
8d9cdc9
 
 
3b240d8
7617af6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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()