Sephfox commited on
Commit
7783422
·
verified ·
1 Parent(s): c0c86be

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -20
app.py CHANGED
@@ -288,28 +288,26 @@ def interactive_interface(input_text):
288
 
289
  emotion_visualization = visualize_emotions()
290
 
291
- analysis_result = {
292
- 'predicted_user_emotion': predicted_emotion,
293
- 'ai_emotion': ai_emotion,
294
- 'sentiment_scores': sentiment_scores,
295
- 'entities': entities,
296
- 'text_complexity': text_complexity,
297
- 'response': response,
298
- 'emotion_visualization': emotion_visualization
299
- }
300
-
301
- return analysis_result
302
  except Exception as e:
303
  print(f"Error: {e}")
304
- return {
305
- 'predicted_user_emotion': 'unknown',
306
- 'ai_emotion': 'neutral',
307
- 'sentiment_scores': {'compound': 0, 'neg': 0, 'neu': 1, 'pos': 0},
308
- 'entities': [],
309
- 'text_complexity': {'word_count': 0, 'sentence_count': 0, 'average_sentence_length': 0, 'polarity': 0, 'subjectivity': 0},
310
- 'response': "I'm sorry, but I encountered an error and was unable to generate a response.",
311
- 'emotion_visualization': 'emotional_state.png'
312
- }
313
 
314
  # Create a Gradio interface
315
  gr.Interface(
 
288
 
289
  emotion_visualization = visualize_emotions()
290
 
291
+ return (
292
+ predicted_emotion,
293
+ ai_emotion,
294
+ str(sentiment_scores),
295
+ str(entities),
296
+ str(text_complexity),
297
+ response,
298
+ emotion_visualization
299
+ )
 
 
300
  except Exception as e:
301
  print(f"Error: {e}")
302
+ return (
303
+ 'unknown',
304
+ 'neutral',
305
+ str({'compound': 0, 'neg': 0, 'neu': 1, 'pos': 0}),
306
+ '[]',
307
+ str({'word_count': 0, 'sentence_count': 0, 'average_sentence_length': 0, 'polarity': 0, 'subjectivity': 0}),
308
+ "I'm sorry, but I encountered an error and was unable to generate a response.",
309
+ 'emotional_state.png'
310
+ )
311
 
312
  # Create a Gradio interface
313
  gr.Interface(