Karthikeyan commited on
Commit
02b5e5d
·
1 Parent(s): 2f96ee6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -25,8 +25,11 @@ 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 to analyze {text} and predict the emotion using scores. Emotions are categorized into the following list: Sadness, Happiness, Joy, Fear, Disgust, and Anger. You need to provide the emotion with the highest score. The scores should be in the range of 0.0 to 1.0, where 1.0 represents the highest intensity of the emotion.
29
- Please analyze the text and provide the output in the following format: emotion: score [with one result having the highest score]."""
 
 
 
30
  response = openai.Completion.create(
31
  model="text-davinci-003",
32
  prompt=prompt,
@@ -206,7 +209,7 @@ class LangChain_Document_QA:
206
  history_state.clear()
207
 
208
  def gradio_interface(self):
209
- with gr.Blocks(css="style.css",theme=gr.themes.Soft()) as demo:
210
  with gr.Row():
211
  gr.HTML("""<center><img class="image" src="https://www.syrahealth.com/images/SyraHealth_Logo_Dark.svg" alt="Image" width="210" height="210"></center>
212
  """)
 
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 text.\
29
+ your are analyze the text and provide the output in the following format: emotion: score [with top 3 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}'''
32
+ """
33
  response = openai.Completion.create(
34
  model="text-davinci-003",
35
  prompt=prompt,
 
209
  history_state.clear()
210
 
211
  def gradio_interface(self):
212
+ with gr.Blocks(css="style.css",theme=gr.themes.dark-glass()) as demo:
213
  with gr.Row():
214
  gr.HTML("""<center><img class="image" src="https://www.syrahealth.com/images/SyraHealth_Logo_Dark.svg" alt="Image" width="210" height="210"></center>
215
  """)