benjaminStreltzin commited on
Commit
7c583bd
·
verified ·
1 Parent(s): b60cbe3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -3
app.py CHANGED
@@ -21,9 +21,17 @@ def report_feedback():
21
  if last_prediction is not None:
22
  image, predicted_label = last_prediction
23
  correct_label = 1 if predicted_label == 0 else 0 # Invert the label
24
- model.add_data(image, correct_label) # Pass the incorrect prediction to the model
25
- return "Feedback recorded. Thank you!"
26
- return "No prediction available to report."
 
 
 
 
 
 
 
 
27
 
28
  # Define the Gradio interface
29
  with gr.Blocks() as demo:
 
21
  if last_prediction is not None:
22
  image, predicted_label = last_prediction
23
  correct_label = 1 if predicted_label == 0 else 0 # Invert the label
24
+ print(f"Reporting feedback: predicted_label={predicted_label}, correct_label={correct_label}") # Debugging line
25
+ try:
26
+ model.add_data(image, correct_label) # Pass the incorrect prediction to the model
27
+ print("Feedback recorded successfully.") # Debugging line
28
+ return "Feedback recorded. Thank you!"
29
+ except Exception as e:
30
+ print(f"Error recording feedback: {e}") # Debugging line
31
+ return f"Error recording feedback: {e}"
32
+ else:
33
+ print("No prediction available to report.") # Debugging line
34
+ return "No prediction available to report."
35
 
36
  # Define the Gradio interface
37
  with gr.Blocks() as demo: