Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -88,7 +88,7 @@ def classify_image(input_image,model_selection):
|
|
| 88 |
|
| 89 |
def show_preds_image(image_path,model_selection):
|
| 90 |
mux_value = str(classify_image(image_path,model_selection)[0])
|
| 91 |
-
if float(classify_image(image_path,model_selection)[1])>0.
|
| 92 |
img = cv2.imread(image_path)
|
| 93 |
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
|
| 94 |
img = cv2.resize(img, (224, 224))
|
|
@@ -139,12 +139,43 @@ def show_preds_image(image_path,model_selection):
|
|
| 139 |
|
| 140 |
|
| 141 |
return img,conf,informations,link_info,google_map
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
else:
|
| 143 |
img = cv2.imread(image_path)
|
| 144 |
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
|
| 145 |
img = cv2.resize(img, (224, 224))
|
| 146 |
conf = (classify_image(image_path,model_selection))
|
| 147 |
-
informations = "
|
| 148 |
link_info = f'''
|
| 149 |
<!DOCTYPE html>
|
| 150 |
<html>
|
|
@@ -152,7 +183,7 @@ def show_preds_image(image_path,model_selection):
|
|
| 152 |
<title>Links</title>
|
| 153 |
</head>
|
| 154 |
<body>
|
| 155 |
-
<h1>NO link provide
|
| 156 |
</body>
|
| 157 |
</html>
|
| 158 |
'''
|
|
@@ -160,10 +191,10 @@ def show_preds_image(image_path,model_selection):
|
|
| 160 |
<!DOCTYPE html>
|
| 161 |
<html>
|
| 162 |
<head>
|
| 163 |
-
<title>Map Display</title>
|
| 164 |
</head>
|
| 165 |
<body>
|
| 166 |
-
<h1>No location
|
| 167 |
</body>
|
| 168 |
</html>
|
| 169 |
'''
|
|
|
|
| 88 |
|
| 89 |
def show_preds_image(image_path,model_selection):
|
| 90 |
mux_value = str(classify_image(image_path,model_selection)[0])
|
| 91 |
+
if float(classify_image(image_path,model_selection)[1])>0.85:
|
| 92 |
img = cv2.imread(image_path)
|
| 93 |
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
|
| 94 |
img = cv2.resize(img, (224, 224))
|
|
|
|
| 139 |
|
| 140 |
|
| 141 |
return img,conf,informations,link_info,google_map
|
| 142 |
+
elif 0.4float(classify_image(image_path,model_selection)[1])<0.85:
|
| 143 |
+
img = cv2.imread(image_path)
|
| 144 |
+
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
|
| 145 |
+
img = cv2.resize(img, (224, 224))
|
| 146 |
+
conf = (classify_image(image_path,model_selection))
|
| 147 |
+
informations = "I'm not sure pls try another input"
|
| 148 |
+
link_info = f'''
|
| 149 |
+
<!DOCTYPE html>
|
| 150 |
+
<html>
|
| 151 |
+
<head>
|
| 152 |
+
<title>Links</title>
|
| 153 |
+
</head>
|
| 154 |
+
<body>
|
| 155 |
+
<h1>NO link provide pls try another input</h1>
|
| 156 |
+
</body>
|
| 157 |
+
</html>
|
| 158 |
+
'''
|
| 159 |
+
google_map = f'''
|
| 160 |
+
<!DOCTYPE html>
|
| 161 |
+
<html>
|
| 162 |
+
<head>
|
| 163 |
+
<title>Map Display pls try another input</title>
|
| 164 |
+
</head>
|
| 165 |
+
<body>
|
| 166 |
+
<h1>No location pls try another input</h1>
|
| 167 |
+
</body>
|
| 168 |
+
</html>
|
| 169 |
+
'''
|
| 170 |
+
|
| 171 |
+
return img,conf,informations,link_info,google_map
|
| 172 |
+
|
| 173 |
else:
|
| 174 |
img = cv2.imread(image_path)
|
| 175 |
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
|
| 176 |
img = cv2.resize(img, (224, 224))
|
| 177 |
conf = (classify_image(image_path,model_selection))
|
| 178 |
+
informations = "Wronge input pls try another input"
|
| 179 |
link_info = f'''
|
| 180 |
<!DOCTYPE html>
|
| 181 |
<html>
|
|
|
|
| 183 |
<title>Links</title>
|
| 184 |
</head>
|
| 185 |
<body>
|
| 186 |
+
<h1>NO link provide pls try another input</h1>
|
| 187 |
</body>
|
| 188 |
</html>
|
| 189 |
'''
|
|
|
|
| 191 |
<!DOCTYPE html>
|
| 192 |
<html>
|
| 193 |
<head>
|
| 194 |
+
<title>Map Display pls try another input</title>
|
| 195 |
</head>
|
| 196 |
<body>
|
| 197 |
+
<h1>No location pls try another input</h1>
|
| 198 |
</body>
|
| 199 |
</html>
|
| 200 |
'''
|