Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -214,24 +214,24 @@ checkpoint = torch.load("Model_IV.pt")
|
|
214 |
# model.load_state_dict(checkpoint) # Load the saved weights
|
215 |
# model.eval() # Set the model to evaluation mode
|
216 |
|
217 |
-
|
218 |
-
#
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
|
236 |
# print(type(checkpoint))
|
237 |
# if isinstance(checkpoint, dict):
|
@@ -254,7 +254,7 @@ def predict(image):
|
|
254 |
# Process output (adjust based on your model's format)
|
255 |
# return output # or post-process the results as needed
|
256 |
results = model(image, save=True)
|
257 |
-
annotated_img = Image.
|
258 |
return annotated_img
|
259 |
|
260 |
# Gradio interface
|
|
|
214 |
# model.load_state_dict(checkpoint) # Load the saved weights
|
215 |
# model.eval() # Set the model to evaluation mode
|
216 |
|
217 |
+
from ultralytics import settings
|
218 |
+
# Update multiple settings
|
219 |
+
settings.update({
|
220 |
+
"names": {0: 'A', 1: 'B',
|
221 |
+
2: 'C', 3: 'D',
|
222 |
+
4: 'E', 5: 'F',
|
223 |
+
6: 'G', 7: 'H',
|
224 |
+
8: 'I', 9: 'J',
|
225 |
+
10: 'K', 11: 'L',
|
226 |
+
12: 'M', 13: 'N',
|
227 |
+
14: 'O', 15: 'P',
|
228 |
+
16: 'Q', 17: 'R',
|
229 |
+
18: 'S', 19: 'T',
|
230 |
+
20: 'U', 21: 'V',
|
231 |
+
22: 'W', 23: 'X',
|
232 |
+
24: 'Y', 25: 'Z'},
|
233 |
+
save_dir: ''
|
234 |
+
})
|
235 |
|
236 |
# print(type(checkpoint))
|
237 |
# if isinstance(checkpoint, dict):
|
|
|
254 |
# Process output (adjust based on your model's format)
|
255 |
# return output # or post-process the results as needed
|
256 |
results = model(image, save=True)
|
257 |
+
annotated_img = Image.open("B111.JPG")
|
258 |
return annotated_img
|
259 |
|
260 |
# Gradio interface
|