Spaces:
Sleeping
Sleeping
update method is not supported for gr.BarPlot
Browse files
app.py
CHANGED
|
@@ -34,7 +34,8 @@ def predict_emotion(text):
|
|
| 34 |
try:
|
| 35 |
if not text:
|
| 36 |
logger.warning("Empty text received")
|
| 37 |
-
|
|
|
|
| 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
|
| 46 |
|
| 47 |
except Exception as e:
|
| 48 |
logger.error(f"Error in prediction: {str(e)}")
|
| 49 |
-
|
|
|
|
| 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(
|