Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -2,12 +2,12 @@ import gradio as gr
|
|
2 |
from transformers import ViTFeatureExtractor, ViTForImageClassification
|
3 |
from PIL import Image
|
4 |
import requests
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
|
12 |
def age_emot_classifier(input_image):
|
13 |
|
@@ -43,6 +43,6 @@ output_emotion = gr.Label(num_top_classes=8, label="Emotion Prediction")
|
|
43 |
|
44 |
with gr.Blocks(theme=gr.themes.Glass()) as demo:
|
45 |
gr.Interface(fn=age_emot_classifier, inputs="image", outputs=[output_age, output_emotion],
|
46 |
-
examples=[
|
47 |
|
48 |
demo.launch()
|
|
|
2 |
from transformers import ViTFeatureExtractor, ViTForImageClassification
|
3 |
from PIL import Image
|
4 |
import requests
|
5 |
+
img1_url = 'https://static3.depositphotos.com/1003410/160/i/450/depositphotos_1607848-stock-photo-portrait-of-old-man.jpg'
|
6 |
+
img1 = Image.open(requests.get(img1_url, stream=True).raw)
|
7 |
+
img2_url = "https://img.freepik.com/free-photo/excited-screaming-young-woman-standing-isolated-yellow_176420-39645.jpg"
|
8 |
+
img2 = Image.open(requests.get(img2_url, stream=True).raw)
|
9 |
+
img3_url = "https://img.freepik.com/free-photo/cute-adorable-boy-studio_58702-7629.jpg"
|
10 |
+
img3 = Image.open(requests.get(img3_url, stream=True).raw)
|
11 |
|
12 |
def age_emot_classifier(input_image):
|
13 |
|
|
|
43 |
|
44 |
with gr.Blocks(theme=gr.themes.Glass()) as demo:
|
45 |
gr.Interface(fn=age_emot_classifier, inputs="image", outputs=[output_age, output_emotion],
|
46 |
+
examples=[img1, img2, img3])
|
47 |
|
48 |
demo.launch()
|