Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -84,7 +84,7 @@ class EmotionalAnalyzer:
|
|
84 |
plt.close()
|
85 |
return path
|
86 |
except Exception:
|
87 |
-
return None
|
88 |
|
89 |
# --- Text Completion LLM ---
|
90 |
tokenizer = AutoTokenizer.from_pretrained("diabolic6045/ELN-Llama-1B-base")
|
@@ -118,7 +118,7 @@ def emotion_aware_response(input_text):
|
|
118 |
try:
|
119 |
analyzer = EmotionalAnalyzer()
|
120 |
results = analyzer.analyze(input_text)
|
121 |
-
image_path = analyzer.plot_emotions()
|
122 |
|
123 |
prompt = (
|
124 |
f"Input: {input_text}\n"
|
@@ -146,7 +146,7 @@ def emotion_aware_response(input_text):
|
|
146 |
f"TextBlob: {results['textblob']}\n\n"
|
147 |
f"LLM Response:\n{response}"
|
148 |
)
|
149 |
-
return summary, image_path
|
150 |
except Exception:
|
151 |
return "Error processing emotion-aware response", None
|
152 |
|
|
|
84 |
plt.close()
|
85 |
return path
|
86 |
except Exception:
|
87 |
+
return None # Ensures that if there's an issue, we return None
|
88 |
|
89 |
# --- Text Completion LLM ---
|
90 |
tokenizer = AutoTokenizer.from_pretrained("diabolic6045/ELN-Llama-1B-base")
|
|
|
118 |
try:
|
119 |
analyzer = EmotionalAnalyzer()
|
120 |
results = analyzer.analyze(input_text)
|
121 |
+
image_path = analyzer.plot_emotions() # This could return None if plotting fails
|
122 |
|
123 |
prompt = (
|
124 |
f"Input: {input_text}\n"
|
|
|
146 |
f"TextBlob: {results['textblob']}\n\n"
|
147 |
f"LLM Response:\n{response}"
|
148 |
)
|
149 |
+
return summary, image_path if image_path else None
|
150 |
except Exception:
|
151 |
return "Error processing emotion-aware response", None
|
152 |
|