Spaces:
Runtime error
Runtime error
Updated metrics
Browse files
app.py
CHANGED
|
@@ -12,9 +12,9 @@ def allure(image, gender):
|
|
| 12 |
gender = gender.lower()
|
| 13 |
image = preprocess(image).unsqueeze(0).to(device)
|
| 14 |
positive_terms = [f'a hot {gender}',
|
| 15 |
-
f'a beautiful {gender}', f'an alluring {gender}', 'a photorealistic image']
|
| 16 |
negative_terms = [f'a gross {gender}',
|
| 17 |
-
f'an ugly {gender}', f'a hideous {gender}', 'an unrealistic image']
|
| 18 |
|
| 19 |
pairs = list(zip(positive_terms, negative_terms))
|
| 20 |
|
|
@@ -41,7 +41,16 @@ def allure(image, gender):
|
|
| 41 |
ugly_score = sum(negative_probs[:-1])/len(negative_probs[:-1])
|
| 42 |
composite = ((hot_score - ugly_score)+1) * 50
|
| 43 |
composite = round(composite, 2)
|
| 44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
|
| 47 |
theme = gr.themes.Soft(
|
|
@@ -83,7 +92,7 @@ with gr.Interface(
|
|
| 83 |
gr.Textbox(label="Hotness (%)"),
|
| 84 |
gr.Textbox(label="Beauty (%)"),
|
| 85 |
gr.Textbox(label="Allure (%)"),
|
| 86 |
-
gr.Textbox(label="Authenticity (
|
| 87 |
],
|
| 88 |
examples=[
|
| 89 |
['Mansib_01_x2048.png', 'Man'],
|
|
|
|
| 12 |
gender = gender.lower()
|
| 13 |
image = preprocess(image).unsqueeze(0).to(device)
|
| 14 |
positive_terms = [f'a hot {gender}',
|
| 15 |
+
f'a beautiful {gender}', f'an alluring {gender}', 'a photorealistic/completely-unedited image']
|
| 16 |
negative_terms = [f'a gross {gender}',
|
| 17 |
+
f'an ugly {gender}', f'a hideous {gender}', 'an unrealistic/heavily-edited image']
|
| 18 |
|
| 19 |
pairs = list(zip(positive_terms, negative_terms))
|
| 20 |
|
|
|
|
| 41 |
ugly_score = sum(negative_probs[:-1])/len(negative_probs[:-1])
|
| 42 |
composite = ((hot_score - ugly_score)+1) * 50
|
| 43 |
composite = round(composite, 2)
|
| 44 |
+
|
| 45 |
+
judgement = "extremely toonish or altered"
|
| 46 |
+
if authenticity_score > 80:
|
| 47 |
+
judgement = "likely real"
|
| 48 |
+
elif authenticity_score > 70:
|
| 49 |
+
judgement = "moderately altered"
|
| 50 |
+
elif authenticity_score > 50:
|
| 51 |
+
judgement = "toonish or very altered"
|
| 52 |
+
|
| 53 |
+
return composite, hotness_score, beauty_score, attractiveness_score, f"{authenticity_score} ({judgement})"
|
| 54 |
|
| 55 |
|
| 56 |
theme = gr.themes.Soft(
|
|
|
|
| 92 |
gr.Textbox(label="Hotness (%)"),
|
| 93 |
gr.Textbox(label="Beauty (%)"),
|
| 94 |
gr.Textbox(label="Allure (%)"),
|
| 95 |
+
gr.Textbox(label="Authenticity (≥ 80% → likely real)"),
|
| 96 |
],
|
| 97 |
examples=[
|
| 98 |
['Mansib_01_x2048.png', 'Man'],
|