Spaces:
Running
Running
File size: 1,272 Bytes
c417f09 74caea8 c417f09 9e15ad2 74caea8 9e15ad2 74caea8 9e15ad2 c417f09 74caea8 9e15ad2 c417f09 74caea8 9e15ad2 c417f09 9e15ad2 c417f09 9e15ad2 c417f09 9e15ad2 c417f09 74caea8 9e15ad2 c417f09 |
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 31 32 33 34 35 36 37 38 39 40 41 |
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()
|