xen2003 commited on
Commit
55b1d7e
·
verified ·
1 Parent(s): 6dcab24

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -91,7 +91,7 @@ def analyze_sentiment(text):
91
  )
92
 
93
  sentiment = response.choices[0].message.content
94
- print(sentiment)
95
  sentiment_history.append(sentiment_scores.get(sentiment.lower(), 0))
96
  print(sentiment_history)
97
  return sentiment
@@ -126,7 +126,7 @@ def transcribe_audio_azure(audio_file_path):
126
  language="en", # Specify the language of the audio (English in this case)
127
  temperature=0.0 # Control the randomness of the output (0.0 means deterministic output)
128
  )
129
- print(f'Transcription done using Azure Whisper')
130
  return transcription.text
131
 
132
  AZURE_GPT_ENDPOINT = 'https://78382-m7ewtltu-eastus2.openai.azure.com/'
@@ -153,7 +153,7 @@ def analyze_sentiment_gpt(text):
153
  max_tokens=10 # Limit the response length to 200 tokens
154
  )
155
  sentiment = response.choices[0].message.content
156
- print(sentiment)
157
  sentiment_history.append(sentiment_scores.get(sentiment.lower(), 0))
158
  print(sentiment_history)
159
  return sentiment
@@ -179,7 +179,7 @@ def analyze_sentiment_azure(client, text):
179
  sentiment = response.sentiment
180
  #print(sentiment)
181
  sentiment_history.append(sentiment_scores.get(sentiment.lower(), 0))
182
- #print(sentiment_history)
183
  return sentiment
184
 
185
  # CLEANUP transcribed text before doing Sentiment Analysis
@@ -260,7 +260,7 @@ def generate_sentiment_heatmap():
260
  # return
261
  # Convert sentiment scores to corresponding colors
262
  heatmap_data = np.array(sentiment_history).reshape(1, -1)
263
- print(heatmap_data)
264
  # Define color mapping for sentiment scores
265
  color_mapping = ["red", "yellow", "green"]
266
  plt.figure(figsize=(6, 3))
 
91
  )
92
 
93
  sentiment = response.choices[0].message.content
94
+ #print(sentiment)
95
  sentiment_history.append(sentiment_scores.get(sentiment.lower(), 0))
96
  print(sentiment_history)
97
  return sentiment
 
126
  language="en", # Specify the language of the audio (English in this case)
127
  temperature=0.0 # Control the randomness of the output (0.0 means deterministic output)
128
  )
129
+ #print(f'Transcription done using Azure Whisper')
130
  return transcription.text
131
 
132
  AZURE_GPT_ENDPOINT = 'https://78382-m7ewtltu-eastus2.openai.azure.com/'
 
153
  max_tokens=10 # Limit the response length to 200 tokens
154
  )
155
  sentiment = response.choices[0].message.content
156
+ #print(sentiment)
157
  sentiment_history.append(sentiment_scores.get(sentiment.lower(), 0))
158
  print(sentiment_history)
159
  return sentiment
 
179
  sentiment = response.sentiment
180
  #print(sentiment)
181
  sentiment_history.append(sentiment_scores.get(sentiment.lower(), 0))
182
+ print(sentiment_history)
183
  return sentiment
184
 
185
  # CLEANUP transcribed text before doing Sentiment Analysis
 
260
  # return
261
  # Convert sentiment scores to corresponding colors
262
  heatmap_data = np.array(sentiment_history).reshape(1, -1)
263
+ #print(heatmap_data)
264
  # Define color mapping for sentiment scores
265
  color_mapping = ["red", "yellow", "green"]
266
  plt.figure(figsize=(6, 3))