douglasgoodwin commited on
Commit
1f6e73f
·
verified ·
1 Parent(s): 74759ef

update method is not supported for gr.BarPlot

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -34,7 +34,8 @@ def predict_emotion(text):
34
  try:
35
  if not text:
36
  logger.warning("Empty text received")
37
- return gr.BarPlot.update(value=default_df)
 
38
 
39
  # Get predictions and create DataFrame
40
  logger.info("Running prediction...")
@@ -42,11 +43,12 @@ def predict_emotion(text):
42
  df = pd.DataFrame(predictions)
43
  logger.info(f"Processed scores:\n{df}")
44
 
45
- return gr.BarPlot.update(value=df)
46
 
47
  except Exception as e:
48
  logger.error(f"Error in prediction: {str(e)}")
49
- return gr.BarPlot.update(value=error_df)
 
50
 
51
  # Create the Gradio interface
52
  demo = gr.Interface(
 
34
  try:
35
  if not text:
36
  logger.warning("Empty text received")
37
+ # Return default DataFrame directly
38
+ return default_df
39
 
40
  # Get predictions and create DataFrame
41
  logger.info("Running prediction...")
 
43
  df = pd.DataFrame(predictions)
44
  logger.info(f"Processed scores:\n{df}")
45
 
46
+ return df # Simply return the DataFrame
47
 
48
  except Exception as e:
49
  logger.error(f"Error in prediction: {str(e)}")
50
+ # Return error DataFrame directly
51
+ return error_df
52
 
53
  # Create the Gradio interface
54
  demo = gr.Interface(