TheFrenchDemos commited on
Commit
eb52977
·
1 Parent(s): 1ff6a56

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -13
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
- 'paid_per_month': f"{subscription:.0f}€",
104
- 'attribution': f"{sim*100:.0f}%",
105
- 'author_month_reward': f"{author_month_reward:.0f}€",
106
- 'ro_month_reward': f"{ro_month_reward:.0f}€",
107
- 'raw_similarity': sim # TEST INSERT valeur brute de similarité (comprise entre 0 et 1) float(sim.item())
108
- # 'paid_per_month': f"{subscription:.0f}€",
109
- # 'paid_per_gen': f"{paid_per_gen:.2f}€",
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