Bey007 commited on
Commit
141f378
·
verified ·
1 Parent(s): 024c0da

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -7
app.py CHANGED
@@ -5,8 +5,7 @@ from pytube import Search
5
  import os
6
 
7
  # Initialize conversational models
8
- empathy_bot = pipeline("text2text-generation", model="mrm8488/t5-base-finetuned-empathy")
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 empathy model for more specific support if the user is distressed
38
- if sentiment['label'] == 'NEGATIVE' and sentiment['score'] > 0.8:
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)