|
import gradio as gr |
|
from PIL import Image |
|
from model import predict |
|
|
|
def interface_fn(image, question): |
|
prediction, confidence, comment = predict(image, question) |
|
return f"Tahmin: {prediction} ({confidence*100:.2f}%)", comment |
|
|
|
demo = gr.Interface( |
|
fn=interface_fn, |
|
inputs=[ |
|
gr.Image(type="pil", label="MRI Görüntüsü Yükle"), |
|
gr.Textbox(label="Görselle ilgili soru", placeholder="Örnek: Bu hasta tedaviye ihtiyaç duyar mı?") |
|
], |
|
outputs=[ |
|
gr.Textbox(label="Tahmin Sonucu"), |
|
gr.Textbox(label="Tbai Yorumu") |
|
], |
|
title="Vbai-DPA 2.3c & Tbai-DPA 1.0-BETA🧠", |
|
description="MRI görüntüsü ile hastalık sınıflandırması yapar ve Tbai modeli ile tıbbi yorum üretir.", |
|
theme="soft" |
|
) |
|
|
|
if __name__ == "__main__": |
|
demo.launch() |
|
|