andrewwwwwwww commited on
Commit
9fb512f
·
verified ·
1 Parent(s): cbd48ae

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -4
app.py CHANGED
@@ -1,15 +1,11 @@
1
  import gradio as gr
2
  from transformers import pipeline
3
 
4
- # Load the model
5
  MODEL_AGE = pipeline('image-classification', model='nateraw/vit-age-classifier', device=-1)
6
 
7
  def predict(image):
8
  age_result = MODEL_AGE(image)
9
- # Get the top prediction
10
  top_age = age_result[0]['label']
11
- # You can return a number or a string, but your iOS app expects a number
12
- # Let's map the label to a representative age (e.g., the midpoint of the range)
13
  age_map = {
14
  "3-9": 6,
15
  "10-19": 15,
 
1
  import gradio as gr
2
  from transformers import pipeline
3
 
 
4
  MODEL_AGE = pipeline('image-classification', model='nateraw/vit-age-classifier', device=-1)
5
 
6
  def predict(image):
7
  age_result = MODEL_AGE(image)
 
8
  top_age = age_result[0]['label']
 
 
9
  age_map = {
10
  "3-9": 6,
11
  "10-19": 15,