Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -8,6 +8,7 @@ warnings.filterwarnings("ignore")
|
|
8 |
import torch
|
9 |
from PIL import Image
|
10 |
import gradio as gr
|
|
|
11 |
|
12 |
import models
|
13 |
|
@@ -38,7 +39,14 @@ def classify(image):
|
|
38 |
|
39 |
result = {index_to_species[str(tops[i].item())].replace("_", " "): round(scores[i].item(), 2) for i in range(len(tops))}
|
40 |
sorted_result = {k: v for k, v in sorted(result.items(), key=lambda item: item[1], reverse=True) if v > 0}
|
|
|
|
|
41 |
|
|
|
|
|
|
|
|
|
|
|
42 |
return sorted_result
|
43 |
|
44 |
|
|
|
8 |
import torch
|
9 |
from PIL import Image
|
10 |
import gradio as gr
|
11 |
+
from datetime import datetime
|
12 |
|
13 |
import models
|
14 |
|
|
|
39 |
|
40 |
result = {index_to_species[str(tops[i].item())].replace("_", " "): round(scores[i].item(), 2) for i in range(len(tops))}
|
41 |
sorted_result = {k: v for k, v in sorted(result.items(), key=lambda item: item[1], reverse=True) if v > 0}
|
42 |
+
# Get the current time
|
43 |
+
current_time = datetime.now()
|
44 |
|
45 |
+
# Format the current time as a string
|
46 |
+
formatted_time = current_time.strftime("%Y-%m-%d %H:%M:%S")
|
47 |
+
|
48 |
+
# Print the formatted time
|
49 |
+
print(f"{formatted_time} {sorted_result}")
|
50 |
return sorted_result
|
51 |
|
52 |
|