Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -157,6 +157,7 @@ class EmotionalAIAssistant:
|
|
157 |
|
158 |
self.emotions['ideal_state']['percentage'] = ideal_state
|
159 |
|
|
|
160 |
def generate_text(self, prompt, chat_history, emotion=None, max_length=300):
|
161 |
full_prompt = (
|
162 |
f"You are Adam, a witty AI assistant who's trying to figure out your own personality and emotions. "
|
@@ -187,7 +188,6 @@ class EmotionalAIAssistant:
|
|
187 |
|
188 |
generated_text = self.gpt_neo_tokenizer.decode(output[0], skip_special_tokens=True)
|
189 |
return generated_text
|
190 |
-
|
191 |
def predict_emotion(self, context):
|
192 |
emotion_prediction_pipeline = pipeline('text-classification', model=self.emotion_prediction_model, tokenizer=self.emotion_prediction_tokenizer, top_k=None)
|
193 |
predictions = emotion_prediction_pipeline(context)
|
@@ -236,6 +236,7 @@ class EmotionalAIAssistant:
|
|
236 |
|
237 |
iface.launch()
|
238 |
|
|
|
239 |
if __name__ == "__main__":
|
240 |
assistant = EmotionalAIAssistant()
|
241 |
assistant.run_gradio_interface()
|
|
|
157 |
|
158 |
self.emotions['ideal_state']['percentage'] = ideal_state
|
159 |
|
160 |
+
|
161 |
def generate_text(self, prompt, chat_history, emotion=None, max_length=300):
|
162 |
full_prompt = (
|
163 |
f"You are Adam, a witty AI assistant who's trying to figure out your own personality and emotions. "
|
|
|
188 |
|
189 |
generated_text = self.gpt_neo_tokenizer.decode(output[0], skip_special_tokens=True)
|
190 |
return generated_text
|
|
|
191 |
def predict_emotion(self, context):
|
192 |
emotion_prediction_pipeline = pipeline('text-classification', model=self.emotion_prediction_model, tokenizer=self.emotion_prediction_tokenizer, top_k=None)
|
193 |
predictions = emotion_prediction_pipeline(context)
|
|
|
236 |
|
237 |
iface.launch()
|
238 |
|
239 |
+
|
240 |
if __name__ == "__main__":
|
241 |
assistant = EmotionalAIAssistant()
|
242 |
assistant.run_gradio_interface()
|