Spaces:
Runtime error
Runtime error
Commit
·
ff9ba81
1
Parent(s):
6ca7ec9
Update app.py
Browse files
app.py
CHANGED
@@ -83,6 +83,16 @@ def distance_to_similarity(distances, temp=1e-4):
|
|
83 |
def calculate_rewards(subscription, num_generations, author_share, ro_share, num_users_k, similarities, num_authors=1800):
|
84 |
"""Calculate rewards based on user inputs and similarities"""
|
85 |
num_users = num_users_k * 1000
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
|
87 |
# Monthly revenue allocated to authors
|
88 |
authors_monthly_revenue = subscription * num_users * (author_share / 100)
|
@@ -107,7 +117,7 @@ def calculate_rewards(subscription, num_generations, author_share, ro_share, num
|
|
107 |
'attribution': f"{sim*100:.0f}%",
|
108 |
'author_month_reward': f"{author_month_reward:.0f}€",
|
109 |
'ro_month_reward': f"{ro_month_reward:.0f}€",
|
110 |
-
'raw_similarity':
|
111 |
# 'paid_per_month': f"{subscription:.0f}€",
|
112 |
# 'paid_per_gen': f"{paid_per_gen:.2f}€",
|
113 |
# 'aro_share': f"{aro_share:.2f}c€",
|
@@ -286,11 +296,3 @@ if __name__ == '__main__':
|
|
286 |
init_model()
|
287 |
app.run(host='0.0.0.0', port=7860)
|
288 |
|
289 |
-
# Extraire les features
|
290 |
-
#image1 = Image.open("static/1.webp")
|
291 |
-
#image2 = Image.open("static/2.webp")
|
292 |
-
#features1 = get_ft(model, image1)
|
293 |
-
#features2 = get_ft(model, image2)
|
294 |
-
|
295 |
-
# Calculer la distance euclidienne
|
296 |
-
#distances = np.linalg.norm(features1 - features2)
|
|
|
83 |
def calculate_rewards(subscription, num_generations, author_share, ro_share, num_users_k, similarities, num_authors=1800):
|
84 |
"""Calculate rewards based on user inputs and similarities"""
|
85 |
num_users = num_users_k * 1000
|
86 |
+
|
87 |
+
# Extraire les features
|
88 |
+
image1 = Image.open("static/1.webp")
|
89 |
+
image2 = Image.open("static/2.webp")
|
90 |
+
features1 = get_ft(model, image1)
|
91 |
+
features2 = get_ft(model, image2)
|
92 |
+
|
93 |
+
# Calculer la distance euclidienne
|
94 |
+
euclid = np.linalg.norm(features1 - features2)
|
95 |
+
|
96 |
|
97 |
# Monthly revenue allocated to authors
|
98 |
authors_monthly_revenue = subscription * num_users * (author_share / 100)
|
|
|
117 |
'attribution': f"{sim*100:.0f}%",
|
118 |
'author_month_reward': f"{author_month_reward:.0f}€",
|
119 |
'ro_month_reward': f"{ro_month_reward:.0f}€",
|
120 |
+
'raw_similarity': euclid
|
121 |
# 'paid_per_month': f"{subscription:.0f}€",
|
122 |
# 'paid_per_gen': f"{paid_per_gen:.2f}€",
|
123 |
# 'aro_share': f"{aro_share:.2f}c€",
|
|
|
296 |
init_model()
|
297 |
app.run(host='0.0.0.0', port=7860)
|
298 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|