Update app.py
Browse files
app.py
CHANGED
|
@@ -193,7 +193,7 @@ def get_summaries_by_sentiment(articles):
|
|
| 193 |
return pos_sum, neg_sum, neutral_sum
|
| 194 |
|
| 195 |
|
| 196 |
-
def comparative_analysis(pos_sum, neg_sum, neutral_sum, model_provider):
|
| 197 |
prompt = f"""
|
| 198 |
Perform a detailed comparative analysis of the sentiment across three categories of articles (Positive, Negative, and Neutral) about a specific company. Address the following aspects:
|
| 199 |
|
|
@@ -248,7 +248,7 @@ Perform a detailed comparative analysis of the sentiment across three categories
|
|
| 248 |
return response
|
| 249 |
|
| 250 |
|
| 251 |
-
def generate_final_report(pos_sum, neg_sum, neutral_sum, comparative_sentiment, model_provider):
|
| 252 |
final_report_prompt = f"""
|
| 253 |
Corporate News Sentiment Analysis Report:
|
| 254 |
|
|
@@ -332,7 +332,7 @@ def generate_final_report(pos_sum, neg_sum, neutral_sum, comparative_sentiment,
|
|
| 332 |
return response
|
| 333 |
|
| 334 |
|
| 335 |
-
def translate(report, model_provider):
|
| 336 |
translation_prompt = f"""
|
| 337 |
Translate the following corporate sentiment analysis report into Hindi:
|
| 338 |
|
|
@@ -398,7 +398,7 @@ def text_to_speech(text):
|
|
| 398 |
st.title("Company Sentiment Analyzer")
|
| 399 |
|
| 400 |
company_name = st.text_input("Enter Company Name", "Tesla")
|
| 401 |
-
|
| 402 |
|
| 403 |
if st.button("Fetch Sentiment Data"):
|
| 404 |
try:
|
|
@@ -408,7 +408,7 @@ if st.button("Fetch Sentiment Data"):
|
|
| 408 |
st.error("No sources found.")
|
| 409 |
else:
|
| 410 |
sentiment_output = [
|
| 411 |
-
analyze_sentiment(article
|
| 412 |
for article in web_results["sources"][:5]
|
| 413 |
]
|
| 414 |
|
|
@@ -423,10 +423,10 @@ if st.button("Fetch Sentiment Data"):
|
|
| 423 |
negative_summary,
|
| 424 |
neutral_summary,
|
| 425 |
comparative_sentiment,
|
| 426 |
-
|
| 427 |
)
|
| 428 |
|
| 429 |
-
hindi_translation = translate(final_report
|
| 430 |
audio_path = text_to_speech(hindi_translation)
|
| 431 |
|
| 432 |
output_dict = {
|
|
|
|
| 193 |
return pos_sum, neg_sum, neutral_sum
|
| 194 |
|
| 195 |
|
| 196 |
+
def comparative_analysis(pos_sum, neg_sum, neutral_sum, model_provider = "Groq"):
|
| 197 |
prompt = f"""
|
| 198 |
Perform a detailed comparative analysis of the sentiment across three categories of articles (Positive, Negative, and Neutral) about a specific company. Address the following aspects:
|
| 199 |
|
|
|
|
| 248 |
return response
|
| 249 |
|
| 250 |
|
| 251 |
+
def generate_final_report(pos_sum, neg_sum, neutral_sum, comparative_sentiment, model_provider = "Groq"):
|
| 252 |
final_report_prompt = f"""
|
| 253 |
Corporate News Sentiment Analysis Report:
|
| 254 |
|
|
|
|
| 332 |
return response
|
| 333 |
|
| 334 |
|
| 335 |
+
def translate(report, model_provider = "Groq"):
|
| 336 |
translation_prompt = f"""
|
| 337 |
Translate the following corporate sentiment analysis report into Hindi:
|
| 338 |
|
|
|
|
| 398 |
st.title("Company Sentiment Analyzer")
|
| 399 |
|
| 400 |
company_name = st.text_input("Enter Company Name", "Tesla")
|
| 401 |
+
|
| 402 |
|
| 403 |
if st.button("Fetch Sentiment Data"):
|
| 404 |
try:
|
|
|
|
| 408 |
st.error("No sources found.")
|
| 409 |
else:
|
| 410 |
sentiment_output = [
|
| 411 |
+
analyze_sentiment(article)
|
| 412 |
for article in web_results["sources"][:5]
|
| 413 |
]
|
| 414 |
|
|
|
|
| 423 |
negative_summary,
|
| 424 |
neutral_summary,
|
| 425 |
comparative_sentiment,
|
| 426 |
+
|
| 427 |
)
|
| 428 |
|
| 429 |
+
hindi_translation = translate(final_report)
|
| 430 |
audio_path = text_to_speech(hindi_translation)
|
| 431 |
|
| 432 |
output_dict = {
|