Spaces:
Runtime error
Runtime error
Commit
·
eb52977
1
Parent(s):
1ff6a56
Update app.py
Browse files
app.py
CHANGED
@@ -99,20 +99,20 @@ def calculate_rewards(subscription, num_generations, author_share, ro_share, num
|
|
99 |
author_month_reward = (authors_monthly_revenue / num_authors) * attribution_bonus
|
100 |
ro_month_reward = author_month_reward / (author_share / 100) * (ro_share / 100)
|
101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
rewards.append({
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
# 'aro_share': f"{aro_share:.2f}c€",
|
111 |
-
# 'attribution': f"{sim*100:.0f}%",
|
112 |
-
# 'training_data_reward': f"{training_data_reward:.2f}c€",
|
113 |
-
# 'author_month_reward': f"{author_month_reward:.0f}€",
|
114 |
-
# 'ro_month_reward': f"{ro_month_reward:.0f}€"
|
115 |
-
})
|
116 |
return rewards
|
117 |
|
118 |
# Global variables for model and index
|
|
|
99 |
author_month_reward = (authors_monthly_revenue / num_authors) * attribution_bonus
|
100 |
ro_month_reward = author_month_reward / (author_share / 100) * (ro_share / 100)
|
101 |
|
102 |
+
try:
|
103 |
+
sim_value = float(sim.item()) if hasattr(sim, "item") else float(sim)
|
104 |
+
except Exception as e:
|
105 |
+
print("Erreur de conversion de sim:", e)
|
106 |
+
sim_value = 0.0 # valeur par défaut en cas d'erreur
|
107 |
+
|
108 |
rewards.append({
|
109 |
+
'paid_per_month': f"{subscription:.0f}€",
|
110 |
+
'attribution': f"{sim * 100:.0f}%",
|
111 |
+
'author_month_reward': f"{author_month_reward:.0f}€",
|
112 |
+
'ro_month_reward': f"{ro_month_reward:.0f}€",
|
113 |
+
'raw_similarity': sim_value # Ajout sécurisé
|
114 |
+
})
|
115 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
return rewards
|
117 |
|
118 |
# Global variables for model and index
|