Spaces:
Sleeping
Sleeping
Upload 3 files
Browse files- app.py +36 -0
- my_model.h5 +3 -0
- requirements.txt +12 -0
app.py
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import numpy as np
|
3 |
+
import pandas as pd
|
4 |
+
import tensorflow as tf
|
5 |
+
from tensorflow.keras.models import load_model
|
6 |
+
from PIL import Image
|
7 |
+
import os
|
8 |
+
|
9 |
+
# Modelin yolu
|
10 |
+
MODEL_PATH = r'C:\Users\devop\OneDrive\Masaüstü\Become apro\TGS - Segmentation Models + Albumentations/my_model.h5' # Model dosyasının yolu
|
11 |
+
model = load_model(MODEL_PATH, compile=False)
|
12 |
+
|
13 |
+
# Uygulamanın başlığı
|
14 |
+
st.title("TGS Tuz Tanımlama Uygulaması")
|
15 |
+
|
16 |
+
# Görüntü yükleme
|
17 |
+
uploaded_file = st.file_uploader("Bir görüntü yükleyin", type=["png", "jpg", "jpeg"])
|
18 |
+
|
19 |
+
if uploaded_file is not None:
|
20 |
+
# Yüklenen görüntüyü oku
|
21 |
+
image = Image.open(uploaded_file).convert("L") # Gri tonlamaya çevir
|
22 |
+
st.image(image, caption='Yüklenen Görüntü', use_column_width=True)
|
23 |
+
|
24 |
+
# Görüntüyü modelin beklediği boyutlara getir
|
25 |
+
image = image.resize((128, 128)) # Hedef boyut
|
26 |
+
image_array = np.array(image) / 255.0 # Normalize et
|
27 |
+
image_array = np.expand_dims(image_array, axis=0) # Boyutunu genişlet
|
28 |
+
|
29 |
+
# Tahmin yap
|
30 |
+
if st.button("Tahmin Et"):
|
31 |
+
prediction = model.predict(image_array)
|
32 |
+
prediction = (prediction > 0.5).astype(np.uint8) # Eşikleme
|
33 |
+
st.image(prediction[0].squeeze(), caption='Tahmin Sonucu', use_column_width=True)
|
34 |
+
|
35 |
+
# Kullanıcı için bilgi
|
36 |
+
st.write("Bu uygulama, yeraltı hedefinin tuz olup olmadığını belirlemek için eğitilmiş bir model kullanır.")
|
my_model.h5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6570a739aea0d40d8a346996381baed8b87e443bebe3939042eb2c32da7e6073
|
3 |
+
size 293966736
|
requirements.txt
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
streamlit
|
2 |
+
tensorflow
|
3 |
+
opencv-python
|
4 |
+
scikit-learn
|
5 |
+
torch
|
6 |
+
torchvision
|
7 |
+
matplotlib
|
8 |
+
transformers
|
9 |
+
sentencepiece
|
10 |
+
plotly
|
11 |
+
xgboost
|
12 |
+
joblib
|