NeerajCodz commited on
Commit
e9f92f1
·
1 Parent(s): 9d29142
Files changed (1) hide show
  1. app.py +12 -2
app.py CHANGED
@@ -505,9 +505,19 @@ async def llm_analyse(payload: LLMAnalysePayload):
505
  # Convert to DataFrame
506
  df = pd.DataFrame(transactions)
507
 
508
- # Convert fraud_score to string with % appended (no scaling)
509
  if 'fraud_score' in df.columns:
510
- df['fraud_score'] = df['fraud_score'].apply(lambda x: f"{x}%")
 
 
 
 
 
 
 
 
 
 
511
 
512
  # Convert DataFrame to CSV string
513
  csv_string = df.to_csv(index=False)
 
505
  # Convert to DataFrame
506
  df = pd.DataFrame(transactions)
507
 
508
+ # Convert fraud_score to percentage string
509
  if 'fraud_score' in df.columns:
510
+ def format_score(x):
511
+ try:
512
+ val = float(x) * 100 # multiply by 100
513
+ if val >= 99:
514
+ return "99%"
515
+ else:
516
+ return f"{round(val, 2)}%"
517
+ except:
518
+ return f"{x}%" # fallback in case of unexpected value
519
+
520
+ df['fraud_score'] = df['fraud_score'].apply(format_score)
521
 
522
  # Convert DataFrame to CSV string
523
  csv_string = df.to_csv(index=False)