Spaces:
Sleeping
Sleeping
| 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 | |
| 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})" | |
| ) |