Spaces:
Running
Running
import gradio as gr | |
from transformers import pipeline | |
# Load models | |
emotion_model = pipeline("text-classification", model="bert-base-uncased") | |
microbiome_model = pipeline("text-generation", model="microsoft/BioGPT-Large") | |
retina_model = pipeline("image-classification", model="microsoft/resnet-50") | |
# Define functions | |
def diagnose_emotion(text): | |
return emotion_model(text) | |
def analyze_microbiome(symptoms): | |
return microbiome_model(symptoms) | |
def analyze_retina(image): | |
return retina_model(image) | |
# Gradio UI | |
with gr.Blocks() as app: | |
gr.Markdown("# Diagnosify-AI - AI Medical Assistant") | |
text_input = gr.Textbox(label="Enter Symptoms") | |
image_input = gr.Image(type="pil", label="Upload Retina Scan") | |
btn1 = gr.Button("Diagnose Emotion-based Disease") | |
btn2 = gr.Button("Analyze Gut Health") | |
btn3 = gr.Button("Detect Retinal Disease") | |
output1 = gr.Textbox(label="Diagnosis") | |
output2 = gr.Textbox(label="Microbiome Analysis") | |
output3 = gr.Label(label="Retinal Disease Prediction") | |
btn1.click(diagnose_emotion, inputs=text_input, outputs=output1) | |
btn2.click(analyze_microbiome, inputs=text_input, outputs=output2) | |
btn3.click(analyze_retina, inputs=image_input, outputs=output3) | |
# Launch the app | |
app.launch() | |