Spaces:
Sleeping
Sleeping
File size: 1,024 Bytes
847c341 3487284 847c341 f0d584a 847c341 | 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 | import streamlit as st
import tensorflow as tf
from PIL import Image
import numpy as np
st.title("El Yazımı Numara Tanıma Sistemi")
st.write("Bir resim yükleyin, AI rakamı tahmin etsin.")
# Modeli yükle
@st.cache_resource
def load_my_model():
return tf.keras.models.load_model("JuliaGetStart.keras")
model = load_my_model()
# Dosya yükleyici
uploaded_file = st.file_uploader("Resim seç...", type=["jpg", "png", "jpeg"])
if uploaded_file is not None:
image = Image.open(uploaded_file).convert('RGB')
st.image(image, caption='Yüklenen Resim', use_column_width=True)
# Ön işleme (Kaggle'daki ile aynı olmalı!)
img = image.resize((64, 64))
img_array = np.array(img) / 255.0
img_array = np.expand_dims(img_array, axis=0)
# Tahmin
prediction = model.predict(img_array)
result = np.argmax(prediction)
score = np.max(prediction)
st.success(#st.metric ile de yapabilirsin
f"Tahmin Edilen Rakam: {result} (Güven Oranı: %{score*100:.2f})"
) |