Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -51,13 +51,13 @@ transform = transforms.Compose([
|
|
51 |
transforms.Normalize([0.5, 0.5, 0.5], [0.5, 0.5, 0.5])
|
52 |
])
|
53 |
|
54 |
-
|
55 |
-
|
56 |
-
image = transform(image).unsqueeze(0).to(device)
|
57 |
with torch.no_grad():
|
58 |
-
output = model(
|
59 |
-
age = output.item()
|
60 |
-
return
|
|
|
61 |
|
62 |
import gradio as gr
|
63 |
|
|
|
51 |
transforms.Normalize([0.5, 0.5, 0.5], [0.5, 0.5, 0.5])
|
52 |
])
|
53 |
|
54 |
+
def predict_age(image: Image.Image) -> float:
|
55 |
+
image_tensor = transform(image).unsqueeze(0).to(device)
|
|
|
56 |
with torch.no_grad():
|
57 |
+
output = model(image_tensor)
|
58 |
+
age = output.item()
|
59 |
+
return round(age, 2)
|
60 |
+
|
61 |
|
62 |
import gradio as gr
|
63 |
|