Spaces:
Runtime error
Runtime error
Commit
·
6ca7ec9
1
Parent(s):
c4c9699
Update app.py
Browse files
app.py
CHANGED
@@ -95,13 +95,19 @@ def calculate_rewards(subscription, num_generations, author_share, ro_share, num
|
|
95 |
# Calculate monthly rewards
|
96 |
author_month_reward = (authors_monthly_revenue / num_authors) * attribution_bonus
|
97 |
ro_month_reward = author_month_reward / (author_share / 100) * (ro_share / 100)
|
98 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
rewards.append({
|
100 |
'paid_per_month': f"{subscription:.0f}€",
|
101 |
'attribution': f"{sim*100:.0f}%",
|
102 |
'author_month_reward': f"{author_month_reward:.0f}€",
|
103 |
'ro_month_reward': f"{ro_month_reward:.0f}€",
|
104 |
-
'raw_similarity':
|
105 |
# 'paid_per_month': f"{subscription:.0f}€",
|
106 |
# 'paid_per_gen': f"{paid_per_gen:.2f}€",
|
107 |
# 'aro_share': f"{aro_share:.2f}c€",
|
|
|
95 |
# Calculate monthly rewards
|
96 |
author_month_reward = (authors_monthly_revenue / num_authors) * attribution_bonus
|
97 |
ro_month_reward = author_month_reward / (author_share / 100) * (ro_share / 100)
|
98 |
+
|
99 |
+
try:
|
100 |
+
sim_value = float(sim.item()) if hasattr(sim, "item") else float(sim)
|
101 |
+
except Exception as e:
|
102 |
+
print("Erreur de conversion de sim:", e)
|
103 |
+
sim_value = 0.0 # valeur par défaut en cas d'erreur
|
104 |
+
|
105 |
rewards.append({
|
106 |
'paid_per_month': f"{subscription:.0f}€",
|
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': sim_value
|
111 |
# 'paid_per_month': f"{subscription:.0f}€",
|
112 |
# 'paid_per_gen': f"{paid_per_gen:.2f}€",
|
113 |
# 'aro_share': f"{aro_share:.2f}c€",
|