Spaces:
Running
Running
app.py
Browse files
app.py
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
# Load open-source model (BioGPT for medical Q&A)
|
| 5 |
+
@st.cache_resource
|
| 6 |
+
def load_model():
|
| 7 |
+
return pipeline("text-generation", model="microsoft/BioGPT-Large")
|
| 8 |
+
|
| 9 |
+
st.set_page_config(page_title="Prescription Bot", page_icon="💊", layout="centered")
|
| 10 |
+
|
| 11 |
+
st.title("💊 AI Prescription Assistant")
|
| 12 |
+
st.write("Describe your symptoms, and I will suggest possible advice and treatment.")
|
| 13 |
+
|
| 14 |
+
user_input = st.text_area("📝 Your symptoms:")
|
| 15 |
+
|
| 16 |
+
if st.button("Get Prescription") and user_input:
|
| 17 |
+
generator = load_model()
|
| 18 |
+
response = generator(user_input, max_length=200, do_sample=True, temperature=0.7)
|
| 19 |
+
st.markdown("### 🩺 Suggested Advice")
|
| 20 |
+
st.write(response[0]['generated_text'])
|