Spaces:
Sleeping
Sleeping
File size: 949 Bytes
f7f6ab2 | 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 | import streamlit as st
import numpy as np
import cv2
from PIL import Image
from tensorflow.keras.models import load_model
st.title("🌵 Kaktüs Tanıma Uygulaması")
st.write("Yüklediğiniz hava fotoğrafında kaktüs olup olmadığını tahmin ediyoruz.")
# Modeli yükle
model = load_model("cactus_model.h5")
# Görsel yükleme
uploaded_file = st.file_uploader("Bir fotoğraf yükleyin (32x32 px olacak şekilde küçültülecek)", type=["jpg", "png"])
if uploaded_file is not None:
image = Image.open(uploaded_file).convert("RGB")
st.image(image, caption="Yüklenen Görsel", use_column_width=True)
# Görseli uygun boyuta getir
img = np.array(image.resize((32, 32))) / 255.0
img = np.expand_dims(img, axis=0)
# Tahmin yap
prediction = model.predict(img)
result = np.argmax(prediction)
st.write("📢 Tahmin:", "Kaktüs VAR 🌵" if result == 1 else "Kaktüs YOK 🏜️")
|