Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -5,8 +5,7 @@ from pytube import Search
|
|
5 |
import os
|
6 |
|
7 |
# Initialize conversational models
|
8 |
-
|
9 |
-
general_bot = pipeline("text-generation", model="microsoft/DialoGPT-medium")
|
10 |
sentiment_analysis = pipeline("sentiment-analysis", model="distilbert-base-uncased-finetuned-sst-2-english")
|
11 |
|
12 |
# Set up Streamlit page
|
@@ -34,11 +33,8 @@ if user_input:
|
|
34 |
# Run sentiment analysis for crisis detection
|
35 |
sentiment = sentiment_analysis(user_input)[0]
|
36 |
|
37 |
-
# Use
|
38 |
-
|
39 |
-
response = empathy_bot(user_input, max_length=150)[0]['generated_text']
|
40 |
-
else:
|
41 |
-
response = general_bot(user_input, max_length=150)[0]['generated_text']
|
42 |
|
43 |
# Display response
|
44 |
st.text_area("Bot's Response:", response, height=150)
|
|
|
5 |
import os
|
6 |
|
7 |
# Initialize conversational models
|
8 |
+
conversational_bot = pipeline("text-generation", model="microsoft/DialoGPT-medium")
|
|
|
9 |
sentiment_analysis = pipeline("sentiment-analysis", model="distilbert-base-uncased-finetuned-sst-2-english")
|
10 |
|
11 |
# Set up Streamlit page
|
|
|
33 |
# Run sentiment analysis for crisis detection
|
34 |
sentiment = sentiment_analysis(user_input)[0]
|
35 |
|
36 |
+
# Use conversational bot for responses
|
37 |
+
response = conversational_bot(user_input, max_length=150)[0]['generated_text']
|
|
|
|
|
|
|
38 |
|
39 |
# Display response
|
40 |
st.text_area("Bot's Response:", response, height=150)
|