Spaces:
Sleeping
Sleeping
Upload 3 files
Browse files- app.py +31 -0
- model.h5 +3 -0
- requirements.txt +2 -0
app.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import numpy as np
|
| 3 |
+
from tensorflow.keras.models import load_model
|
| 4 |
+
from tensorflow.keras.preprocessing import image
|
| 5 |
+
|
| 6 |
+
# Modeli yükle
|
| 7 |
+
model = load_model('model.h5') # Modelinizi burada yükleyin
|
| 8 |
+
|
| 9 |
+
# Uygulama başlığı
|
| 10 |
+
st.title("🩺 Pneumonia Classification App")
|
| 11 |
+
st.write("📷 **X-ray görüntüsünü yükleyin ve pnömoni olup olmadığını kontrol edin.**")
|
| 12 |
+
|
| 13 |
+
# Dosya yükleme alanı
|
| 14 |
+
uploaded_file = st.file_uploader("🖼️ Resim yükle", type=["jpeg", "jpg", "png"])
|
| 15 |
+
|
| 16 |
+
if uploaded_file is not None:
|
| 17 |
+
# Resmi yükle
|
| 18 |
+
img = image.load_img(uploaded_file, target_size=(150, 150))
|
| 19 |
+
st.image(img, caption='Yüklenen Resim', use_column_width=True)
|
| 20 |
+
st.write("")
|
| 21 |
+
st.write("🔍 **Tahmin ediliyor...**")
|
| 22 |
+
|
| 23 |
+
# Resmi işleyin ve model ile tahmin yapın
|
| 24 |
+
img_array = image.img_to_array(img)
|
| 25 |
+
img_array = np.expand_dims(img_array, axis=0) / 255.0 # Normalizasyon
|
| 26 |
+
|
| 27 |
+
prediction = model.predict(img_array)
|
| 28 |
+
class_names = ['🟢 Normal', '🔴 Pneumonia']
|
| 29 |
+
predicted_class = class_names[int(prediction[0] > 0.5)]
|
| 30 |
+
|
| 31 |
+
st.success(f"✅ **Tahmin: {predicted_class}**" if predicted_class == '🟢 Normal' else f"🚨 **Tahmin: {predicted_class}**")
|
model.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6b3707a040e8fd91cb47b095535d00428a7b756e7c185b84ec822c57e56ccbc0
|
| 3 |
+
size 228458584
|
requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
tensorflow
|
| 2 |
+
streamlit
|