Karthikeyan commited on
Commit
3227853
1 Parent(s): eaed23c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -6
app.py CHANGED
@@ -25,7 +25,7 @@ class SentimentAnalyzer:
25
  sentiment_scores_str = f"Positive: {sentiment_scores['positive']:.2f}, Neutral: {sentiment_scores['neutral']:.2f}, Negative: {sentiment_scores['negative']:.2f}"
26
  return sentiment_scores_str
27
  def emotion_analysis(self,text):
28
- prompt = f""" Your task is find the top 1 emotion : <Sadness, Happiness, Joy, Fear, Disgust, Anger> and it's emotion score of the text.\
29
  your are analyze the text and provide the output in the following list format heigher to lower order: ["emotion1","emotion2","emotion3"][score1,score2,score3]''' [with top 1 result having the highest score]
30
  The scores should be in the range of 0.0 to 1.0, where 1.0 represents the highest intensity of the emotion.\
31
  analyze the text : '''{text}'''
@@ -39,9 +39,7 @@ class SentimentAnalyzer:
39
  frequency_penalty=0,
40
  presence_penalty=0
41
  )
42
-
43
  message = response.choices[0].text.strip().replace("\n","")
44
- print(message)
45
  return message
46
 
47
  def analyze_sentiment_for_graph(self, text):
@@ -72,9 +70,7 @@ class Summarizer:
72
  openai.api_key=os.getenv("OPENAI_API_KEY")
73
  def generate_summary(self, text):
74
  model_engine = "text-davinci-003"
75
- prompt = f"""summarize the following conversation delimited by triple backticks.
76
- write within 30 words.
77
- ```{text}``` """
78
  completions = openai.Completion.create(
79
  engine=model_engine,
80
  prompt=prompt,
 
25
  sentiment_scores_str = f"Positive: {sentiment_scores['positive']:.2f}, Neutral: {sentiment_scores['neutral']:.2f}, Negative: {sentiment_scores['negative']:.2f}"
26
  return sentiment_scores_str
27
  def emotion_analysis(self,text):
28
+ prompt = f""" Your task is find the top 3 emotion : <Sadness, Happiness, Joy, Fear, Disgust, Anger> and it's emotion score of the Mental Healthcare Doctor Chatbot and patient conversation text.\
29
  your are analyze the text and provide the output in the following list format heigher to lower order: ["emotion1","emotion2","emotion3"][score1,score2,score3]''' [with top 1 result having the highest score]
30
  The scores should be in the range of 0.0 to 1.0, where 1.0 represents the highest intensity of the emotion.\
31
  analyze the text : '''{text}'''
 
39
  frequency_penalty=0,
40
  presence_penalty=0
41
  )
 
42
  message = response.choices[0].text.strip().replace("\n","")
 
43
  return message
44
 
45
  def analyze_sentiment_for_graph(self, text):
 
70
  openai.api_key=os.getenv("OPENAI_API_KEY")
71
  def generate_summary(self, text):
72
  model_engine = "text-davinci-003"
73
+ prompt = f"""summarize the following conversation delimited by triple backticks. write within 30 words.```{text}``` """
 
 
74
  completions = openai.Completion.create(
75
  engine=model_engine,
76
  prompt=prompt,