Mansib commited on
Commit
b43460b
·
1 Parent(s): 9fcb04c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -8,7 +8,7 @@ model, preprocess = clip.load("ViT-B/32", device=device)
8
 
9
  def allure(image, gender):
10
  image = Image.fromarray(image.astype("uint8"), "RGB")
11
-
12
  image = preprocess(image).unsqueeze(0).to(device)
13
  positive_terms = [f'a hot {gender}', f'a beautiful {gender}', f'an alluring {gender}']
14
  negative_terms = [f'a gross {gender}', f'an ugly {gender}', f'a hideous {gender}']
@@ -44,16 +44,16 @@ iface = gr.Interface(
44
  gr.inputs.Image(label="Image"),
45
  gr.inputs.Dropdown(
46
  [
47
- 'person', 'man', 'woman'
48
  ],
49
- default='person',
50
  )
51
  ],
52
  outputs=[
53
- gr.Textbox(label="Summary"),
54
- gr.Textbox(label="Hotness"),
55
- gr.Textbox(label="Beauty"),
56
- gr.Textbox(label="Allure"),
57
  ],
58
  title="Attractiveness Evaluator (using OpenAI CLIP)",
59
  description="A simple attractiveness evaluation app using OpenAI's CLIP model. \nHow it works: \nThe input image is passed to OpenAI's CLIP image captioning model and evaluated for how much it conforms to the model's idea of hotness, beauty, and attractiveness. These values are then combined to produce a composite score on a scale of 0 to 100.\nNote: This is meant solely for educational use.",
 
8
 
9
  def allure(image, gender):
10
  image = Image.fromarray(image.astype("uint8"), "RGB")
11
+ gender = gender.lower()
12
  image = preprocess(image).unsqueeze(0).to(device)
13
  positive_terms = [f'a hot {gender}', f'a beautiful {gender}', f'an alluring {gender}']
14
  negative_terms = [f'a gross {gender}', f'an ugly {gender}', f'a hideous {gender}']
 
44
  gr.inputs.Image(label="Image"),
45
  gr.inputs.Dropdown(
46
  [
47
+ 'Person', 'Man', 'Woman'
48
  ],
49
+ default='Person',
50
  )
51
  ],
52
  outputs=[
53
+ gr.Textbox(label="Composite (%)"),
54
+ gr.Textbox(label="Hotness (%)"),
55
+ gr.Textbox(label="Beauty (%)"),
56
+ gr.Textbox(label="Allure (%)"),
57
  ],
58
  title="Attractiveness Evaluator (using OpenAI CLIP)",
59
  description="A simple attractiveness evaluation app using OpenAI's CLIP model. \nHow it works: \nThe input image is passed to OpenAI's CLIP image captioning model and evaluated for how much it conforms to the model's idea of hotness, beauty, and attractiveness. These values are then combined to produce a composite score on a scale of 0 to 100.\nNote: This is meant solely for educational use.",