Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -61,10 +61,12 @@ def predict_age(image):
|
|
| 61 |
age = output.item() # Convert to a single scalar
|
| 62 |
return f"Predicted Age: {age:.2f}"
|
| 63 |
|
| 64 |
-
|
|
|
|
|
|
|
| 65 |
iface = gr.Interface(
|
| 66 |
fn=predict_age,
|
| 67 |
-
inputs=gr.
|
| 68 |
outputs="text",
|
| 69 |
title="Age Prediction Model",
|
| 70 |
description="Upload an image to predict the age.",
|
|
@@ -72,3 +74,4 @@ iface = gr.Interface(
|
|
| 72 |
)
|
| 73 |
|
| 74 |
iface.launch()
|
|
|
|
|
|
| 61 |
age = output.item() # Convert to a single scalar
|
| 62 |
return f"Predicted Age: {age:.2f}"
|
| 63 |
|
| 64 |
+
import gradio as gr
|
| 65 |
+
|
| 66 |
+
# Replace gr.inputs.Image with just gr.Image
|
| 67 |
iface = gr.Interface(
|
| 68 |
fn=predict_age,
|
| 69 |
+
inputs=gr.Image(shape=(128, 128), image_mode='RGB', source='upload'),
|
| 70 |
outputs="text",
|
| 71 |
title="Age Prediction Model",
|
| 72 |
description="Upload an image to predict the age.",
|
|
|
|
| 74 |
)
|
| 75 |
|
| 76 |
iface.launch()
|
| 77 |
+
|