Update app.py
Browse files
app.py
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
model_yolu = "buketyeter/blood_cell_project"
|
| 5 |
+
|
| 6 |
+
pipe = pipeline("image-classification", model=model_yolu)
|
| 7 |
+
|
| 8 |
+
def tahmin_et(resim):
|
| 9 |
+
sonuclar = pipe(resim)
|
| 10 |
+
return {sonuc['label']: sonuc['score'] for sonuc in sonuclar}
|
| 11 |
+
|
| 12 |
+
# Arayüz Tasarımı
|
| 13 |
+
arayuz = gr.Interface(
|
| 14 |
+
fn=tahmin_et,
|
| 15 |
+
inputs=gr.Image(type="pil"),
|
| 16 |
+
outputs=gr.Label(num_top_classes=3),
|
| 17 |
+
title="AI Blood Cell Analysis System",
|
| 18 |
+
description="""
|
| 19 |
+
This application is an automated blood cell classification system powered by a fine-tuned **SwinV2 Transformer** architecture.
|
| 20 |
+
Please upload a microscopic blood cell image to analyze and identify its type.
|
| 21 |
+
""",
|
| 22 |
+
theme="default"
|
| 23 |
+
)
|
| 24 |
+
|
| 25 |
+
arayuz.launch()
|