Spaces:
Build error
Build error
| import streamlit as st | |
| import tensorflow as tf | |
| from tensorflow.keras.models import load_model | |
| from PIL import Image | |
| import numpy as np | |
| # Model yükle | |
| model = load_model('bird_classification_model.h5') | |
| # Sınıf isimleri | |
| class_names = ["Alexandrine Parakeet", "Baya Weaver", "Cattle Egret", "Common Kingfisher", "Common Myna", "Coppersmith Barbet", "Crested Serpent Eagle", "Gray Wagtail", "Indian Cormorant", "Indian Peafowl", "Indian Pitta", "Jungle Babbler", "Loten's Sunbird", "Oriental Magpie Robin", "Pied Bushchat", "Red Munia", "Red Whiskered Bulbul", "Rose Ringed Parakeet", "Rufous Treepie", "Sarus Crane", "Shikra", "Spotted Dove", "Spotted Owlet", "White Breasted Kingfisher", "White Breasted Waterhen"] | |
| st.title('Hint Kuşları Sınıflandırma') | |
| uploaded_file = st.file_uploader("Bir kuş resmi yükleyin", type=["jpg", "jpeg", "png"]) | |
| if uploaded_file is not None: | |
| image = Image.open(uploaded_file) | |
| st.image(image, caption='Yüklenen Resim', use_column_width=True) | |
| # Resmi model için hazırla | |
| image = image.resize((128, 128)) | |
| image_array = np.array(image) / 255.0 | |
| image_array = np.expand_dims(image_array, axis=0) | |
| # Tahmin yap | |
| predictions = model.predict(image_array) | |
| predicted_class = class_names[np.argmax(predictions[0])] | |
| confidence = np.max(predictions[0]) | |
| st.write(f"Tahmin: {predicted_class}") | |
| st.write(f"Güven: {confidence:.2f}") |