yangswei commited on
Commit
8bfff95
1 Parent(s): 67f31c3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
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
- ts_url = 'https://static.promediateknologi.id/crop/0x0:0x0/0x0/webp/photo/p2/01/2023/08/10/taylor-swift-3169402579.png'
6
- ts_image = Image.open(requests.get(ts_url, stream=True).raw)
7
- pg_url = "https://media.vogue.co.uk/photos/60f888a382e60565201c7cf4/2:3/w_2560%2Cc_limit/prince-Grorge-eigth-birthday-portrait.jpg"
8
- pg_image = Image.open(requests.get(pg_url, stream=True).raw)
9
- img_url = "https://thumbs.dreamstime.com/b/old-man-20313005.jpg"
10
- img_image = Image.open(requests.get(img_url, stream=True).raw)
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=[ts_image, pg_image, img_image])
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()