Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,27 +1,9 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
-
from transformers import pipeline
|
3 |
|
4 |
-
|
|
|
5 |
|
6 |
-
|
7 |
-
age_result = MODEL_AGE(image)
|
8 |
-
top_age = age_result[0]['label']
|
9 |
-
age_map = {
|
10 |
-
"3-9": 6,
|
11 |
-
"10-19": 15,
|
12 |
-
"20-29": 25,
|
13 |
-
"30-39": 35,
|
14 |
-
"40-49": 45,
|
15 |
-
"50-59": 55,
|
16 |
-
"60-69": 65,
|
17 |
-
"more than 70": 75
|
18 |
-
}
|
19 |
-
return {"data": [age_map.get(top_age, 30)]}
|
20 |
|
21 |
-
iface
|
22 |
-
fn=predict,
|
23 |
-
inputs=gr.Image(type="pil"),
|
24 |
-
outputs=gr.Json()
|
25 |
-
)
|
26 |
-
|
27 |
-
iface.launch(share=True)
|
|
|
1 |
+
# temporary_app.py
|
2 |
import gradio as gr
|
|
|
3 |
|
4 |
+
def greet(name):
|
5 |
+
return "Hello, " + name + "!"
|
6 |
|
7 |
+
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
+
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|