File size: 571 Bytes
bc74133
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from transformers import pipeline
import gradio as gr

# Load the medical model
pipe = pipeline("text-generation", model="Intelligent-Internet/II-Medical-8B")

def generate_response(user_input):
    result = pipe(user_input, max_new_tokens=100)[0]["generated_text"]
    return result

demo = gr.Interface(
    fn=generate_response,
    inputs=gr.Textbox(lines=2, placeholder="Ask your medical question..."),
    outputs="text",
    title="II-Medical-8B Medical Chat",
    description="Ask any health-related question powered by the II-Medical-8B model."
)

demo.launch()