Spaces:
Sleeping
Sleeping
Update config.py
Browse files
config.py
CHANGED
@@ -76,95 +76,10 @@ MIN_ARTICLES = 20
|
|
76 |
MAX_ARTICLES_PER_SOURCE = 10 # Adjusted for more sources
|
77 |
MAX_ARTICLES = 50 # Increased to accommodate more sources
|
78 |
|
79 |
-
# Browser Headers
|
80 |
-
HEADERS = {
|
81 |
-
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win"""Configuration settings for the News Summarization application."""
|
82 |
-
|
83 |
-
import os
|
84 |
-
from dotenv import load_dotenv
|
85 |
-
|
86 |
-
# Load environment variables
|
87 |
-
load_dotenv()
|
88 |
-
|
89 |
-
# API Settings - Modified for direct processing
|
90 |
-
API_HOST = "localhost" # Changed from 0.0.0.0
|
91 |
-
API_PORT = 8501 # Changed to Streamlit's default port
|
92 |
-
API_BASE_URL = "http://localhost:8501" # Direct URL for local processing
|
93 |
-
|
94 |
-
# News Scraping Settings
|
95 |
-
ARTICLES_PER_SOURCE = int(os.getenv("ARTICLES_PER_SOURCE", "10"))
|
96 |
-
USER_AGENT = os.getenv("USER_AGENT", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36")
|
97 |
-
|
98 |
-
# RSS Feed Settings
|
99 |
-
RSS_FEEDS = {
|
100 |
-
"BBC": "http://feeds.bbci.co.uk/news/business/rss.xml",
|
101 |
-
"CNN": "http://rss.cnn.com/rss/money_news_international.rss",
|
102 |
-
"FoxBusiness": "http://feeds.foxnews.com/foxbusiness/latest"
|
103 |
-
}
|
104 |
-
|
105 |
-
# Model Settings
|
106 |
-
SENTIMENT_MODEL = "yiyanghkust/finbert-tone" # More advanced financial sentiment model
|
107 |
-
SENTIMENT_FINE_GRAINED_MODEL = "mrm8488/distilroberta-finetuned-financial-news-sentiment-analysis"
|
108 |
-
SUMMARIZATION_MODEL = "t5-base"
|
109 |
-
|
110 |
-
# Additional Fine-Grained Sentiment Models
|
111 |
-
FINE_GRAINED_MODELS = {
|
112 |
-
"financial": "mrm8488/distilroberta-finetuned-financial-news-sentiment-analysis",
|
113 |
-
"emotion": "j-hartmann/emotion-english-distilroberta-base",
|
114 |
-
"aspect": "yangheng/deberta-v3-base-absa-v1.1",
|
115 |
-
"esg": "yiyanghkust/finbert-esg",
|
116 |
-
"news_tone": "ProsusAI/finbert"
|
117 |
-
}
|
118 |
-
|
119 |
-
# Fine-Grained Sentiment Categories
|
120 |
-
SENTIMENT_CATEGORIES = {
|
121 |
-
"financial": ["positive", "negative", "neutral"],
|
122 |
-
"emotion": ["joy", "sadness", "anger", "fear", "surprise", "disgust", "neutral"],
|
123 |
-
"aspect": ["positive", "negative", "neutral"],
|
124 |
-
"esg": ["environmental", "social", "governance", "neutral"],
|
125 |
-
"news_tone": ["positive", "negative", "neutral"]
|
126 |
-
}
|
127 |
-
|
128 |
-
# Cache Settings
|
129 |
-
CACHE_DIR = os.getenv("CACHE_DIR", ".cache")
|
130 |
-
CACHE_EXPIRY = int(os.getenv("CACHE_EXPIRY", "3600")) # 1 hour
|
131 |
-
CACHE_DURATION = int(os.getenv("CACHE_DURATION", "300")) # 5 minutes in seconds
|
132 |
-
|
133 |
-
# Audio Settings
|
134 |
-
AUDIO_OUTPUT_DIR = os.getenv("AUDIO_OUTPUT_DIR", "audio_output")
|
135 |
-
DEFAULT_LANG = os.getenv("DEFAULT_LANG", "hi") # Hindi
|
136 |
-
|
137 |
-
# News Sources
|
138 |
-
NEWS_SOURCES = {
|
139 |
-
# Major News Aggregators
|
140 |
-
"google": "https://www.google.com/search?q={}&tbm=nws",
|
141 |
-
"bing": "https://www.bing.com/news/search?q={}",
|
142 |
-
"yahoo": "https://news.search.yahoo.com/search?p={}",
|
143 |
-
|
144 |
-
# Financial News
|
145 |
-
"reuters": "https://www.reuters.com/search/news?blob={}",
|
146 |
-
"marketwatch": "https://www.marketwatch.com/search?q={}&ts=0&tab=All%20News",
|
147 |
-
"investing": "https://www.investing.com/search/?q={}&tab=news",
|
148 |
-
|
149 |
-
# Tech News
|
150 |
-
"techcrunch": "https://techcrunch.com/search/{}",
|
151 |
-
"zdnet": "https://www.zdnet.com/search/?q={}",
|
152 |
-
}
|
153 |
-
|
154 |
-
# Article limits
|
155 |
-
MIN_ARTICLES = 20
|
156 |
-
MAX_ARTICLES_PER_SOURCE = 10 # Adjusted for more sources
|
157 |
-
MAX_ARTICLES = 50 # Increased to accommodate more sources
|
158 |
-
|
159 |
# Browser Headers
|
160 |
HEADERS = {
|
161 |
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
|
162 |
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
|
163 |
"Accept-Language": "en-US,en;q=0.5",
|
164 |
"Connection": "keep-alive"
|
165 |
-
}
|
166 |
-
64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
|
167 |
-
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
|
168 |
-
"Accept-Language": "en-US,en;q=0.5",
|
169 |
-
"Connection": "keep-alive"
|
170 |
-
}
|
|
|
76 |
MAX_ARTICLES_PER_SOURCE = 10 # Adjusted for more sources
|
77 |
MAX_ARTICLES = 50 # Increased to accommodate more sources
|
78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
# Browser Headers
|
80 |
HEADERS = {
|
81 |
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
|
82 |
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
|
83 |
"Accept-Language": "en-US,en;q=0.5",
|
84 |
"Connection": "keep-alive"
|
85 |
+
}
|
|
|
|
|
|
|
|
|
|