Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -2,6 +2,7 @@ import gradio as gr
|
|
2 |
from transformers import AutoFeatureExtractor, AutoModelForImageClassification
|
3 |
from PIL import Image
|
4 |
import torch
|
|
|
5 |
|
6 |
# Carregue o extrator de recursos e o modelo
|
7 |
extractor = AutoFeatureExtractor.from_pretrained("SerdarHelli/ThyroidTumorClassificationModel")
|
@@ -30,10 +31,14 @@ def classify_image(image):
|
|
30 |
# Rótulo da classe prevista
|
31 |
predicted_label = class_labels[predicted_class]
|
32 |
|
33 |
-
#
|
|
|
|
|
|
|
34 |
result_html = f"""
|
35 |
<h2>Resultado da Classificação</h2>
|
36 |
<p><strong>Classe Predita:</strong> {predicted_label}</p>
|
|
|
37 |
"""
|
38 |
|
39 |
# Retorna o resultado formatado em HTML
|
|
|
2 |
from transformers import AutoFeatureExtractor, AutoModelForImageClassification
|
3 |
from PIL import Image
|
4 |
import torch
|
5 |
+
import datetime
|
6 |
|
7 |
# Carregue o extrator de recursos e o modelo
|
8 |
extractor = AutoFeatureExtractor.from_pretrained("SerdarHelli/ThyroidTumorClassificationModel")
|
|
|
31 |
# Rótulo da classe prevista
|
32 |
predicted_label = class_labels[predicted_class]
|
33 |
|
34 |
+
# Obtém a data e hora atual
|
35 |
+
current_time = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
36 |
+
|
37 |
+
# Formate a saída em HTML com data e hora
|
38 |
result_html = f"""
|
39 |
<h2>Resultado da Classificação</h2>
|
40 |
<p><strong>Classe Predita:</strong> {predicted_label}</p>
|
41 |
+
<p><strong>Data e Hora:</strong> {current_time}</p>
|
42 |
"""
|
43 |
|
44 |
# Retorna o resultado formatado em HTML
|