Update app.py
#5
by MLDeveloper - opened
app.py
CHANGED
|
@@ -1,13 +1,13 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import requests
|
| 3 |
import firebase_admin
|
| 4 |
-
from firebase_admin import credentials, db
|
| 5 |
from PIL import Image
|
| 6 |
import numpy as np
|
| 7 |
from geopy.geocoders import Nominatim
|
| 8 |
from tensorflow.keras.applications import MobileNetV2
|
| 9 |
from tensorflow.keras.applications.mobilenet_v2 import decode_predictions, preprocess_input
|
| 10 |
-
import
|
| 11 |
|
| 12 |
# Initialize Firebase
|
| 13 |
if not firebase_admin._apps:
|
|
@@ -16,6 +16,9 @@ if not firebase_admin._apps:
|
|
| 16 |
'databaseURL': 'https://binsight-beda0-default-rtdb.asia-southeast1.firebasedatabase.app/'
|
| 17 |
})
|
| 18 |
|
|
|
|
|
|
|
|
|
|
| 19 |
# Load MobileNetV2 pre-trained model
|
| 20 |
mobilenet_model = MobileNetV2(weights="imagenet")
|
| 21 |
|
|
@@ -104,8 +107,6 @@ if submit_button and uploaded_file:
|
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
-
|
| 108 |
-
|
| 109 |
# best with firebase but below code is not giving correct location of user.
|
| 110 |
|
| 111 |
# import streamlit as st
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import requests
|
| 3 |
import firebase_admin
|
| 4 |
+
from firebase_admin import credentials, db
|
| 5 |
from PIL import Image
|
| 6 |
import numpy as np
|
| 7 |
from geopy.geocoders import Nominatim
|
| 8 |
from tensorflow.keras.applications import MobileNetV2
|
| 9 |
from tensorflow.keras.applications.mobilenet_v2 import decode_predictions, preprocess_input
|
| 10 |
+
from tensorflow.keras import backend as K
|
| 11 |
|
| 12 |
# Initialize Firebase
|
| 13 |
if not firebase_admin._apps:
|
|
|
|
| 16 |
'databaseURL': 'https://binsight-beda0-default-rtdb.asia-southeast1.firebasedatabase.app/'
|
| 17 |
})
|
| 18 |
|
| 19 |
+
# Clear previous TensorFlow session to avoid session-related errors
|
| 20 |
+
K.clear_session()
|
| 21 |
+
|
| 22 |
# Load MobileNetV2 pre-trained model
|
| 23 |
mobilenet_model = MobileNetV2(weights="imagenet")
|
| 24 |
|
|
|
|
| 107 |
|
| 108 |
|
| 109 |
|
|
|
|
|
|
|
| 110 |
# best with firebase but below code is not giving correct location of user.
|
| 111 |
|
| 112 |
# import streamlit as st
|