Spaces:
Runtime error
Runtime error
CAGIL DENIZCAN DURGUN
commited on
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import pipeline
|
| 2 |
+
import gradio as gr
|
| 3 |
+
|
| 4 |
+
# Load the medical model
|
| 5 |
+
pipe = pipeline("text-generation", model="Intelligent-Internet/II-Medical-8B")
|
| 6 |
+
|
| 7 |
+
def generate_response(user_input):
|
| 8 |
+
result = pipe(user_input, max_new_tokens=100)[0]["generated_text"]
|
| 9 |
+
return result
|
| 10 |
+
|
| 11 |
+
demo = gr.Interface(
|
| 12 |
+
fn=generate_response,
|
| 13 |
+
inputs=gr.Textbox(lines=2, placeholder="Ask your medical question..."),
|
| 14 |
+
outputs="text",
|
| 15 |
+
title="II-Medical-8B Medical Chat",
|
| 16 |
+
description="Ask any health-related question powered by the II-Medical-8B model."
|
| 17 |
+
)
|
| 18 |
+
|
| 19 |
+
demo.launch()
|