Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -84,7 +84,7 @@ def analyze_sentiment(text):
|
|
| 84 |
response = grog_client.chat.completions.create(
|
| 85 |
model="llama3-8b-8192", # Specify the model to be used for generating the completion
|
| 86 |
messages=[
|
| 87 |
-
{"role": "system", "content": "Analyze the sentiment of this text and return only 'Positive', 'Negative', or 'Neutral'."},
|
| 88 |
{"role": "user", "content": text}
|
| 89 |
],
|
| 90 |
temperature=0.0, # Control the randomness of the output (0.0 means deterministic output)
|
|
@@ -404,6 +404,9 @@ def process_video_gradio(video_path):
|
|
| 404 |
|
| 405 |
segment_text = transcribe_audio(segment_path) # CALL transcribe audio using Groq Whisper
|
| 406 |
#segment_text = transcribe_audio_azure(segment_path) # CALL transcribe audio using Azure Whisper
|
|
|
|
|
|
|
|
|
|
| 407 |
transcribed_text += segment_text + "\n" # added new line for display purpose
|
| 408 |
preprocess_text(segment_text)
|
| 409 |
|
|
|
|
| 84 |
response = grog_client.chat.completions.create(
|
| 85 |
model="llama3-8b-8192", # Specify the model to be used for generating the completion
|
| 86 |
messages=[
|
| 87 |
+
{"role": "system", "content": "You are an expert in text sentiment analysis. Analyze the sentiment of this text and return only 'Positive', 'Negative', or 'Neutral'."},
|
| 88 |
{"role": "user", "content": text}
|
| 89 |
],
|
| 90 |
temperature=0.0, # Control the randomness of the output (0.0 means deterministic output)
|
|
|
|
| 404 |
|
| 405 |
segment_text = transcribe_audio(segment_path) # CALL transcribe audio using Groq Whisper
|
| 406 |
#segment_text = transcribe_audio_azure(segment_path) # CALL transcribe audio using Azure Whisper
|
| 407 |
+
|
| 408 |
+
# Insert segment number inside the text for easy comparison with Sentiment Trend
|
| 409 |
+
segment_text = f"[{i}] {segment_text}"
|
| 410 |
transcribed_text += segment_text + "\n" # added new line for display purpose
|
| 411 |
preprocess_text(segment_text)
|
| 412 |
|