Firemedic15 commited on
Commit
bbf5058
·
verified ·
1 Parent(s): f2dc9cb

Upload 7 files

Browse files
Files changed (2) hide show
  1. app.py +86 -22
  2. tools.py +20 -1
app.py CHANGED
@@ -75,8 +75,9 @@ def run_analysis(
75
  - Raw agent trace for transparency
76
  - ThreatBrief object (stored in gr.State for PDF export)
77
  """
78
- if not country.strip():
79
- return "<p style='color:red'>Please enter a country or region.</p>", "", None
 
80
 
81
  progress(0.1, desc="Initializing agent...")
82
 
@@ -179,26 +180,86 @@ Today's date: {datetime.utcnow().strftime('%Y-%m-%d')}
179
 
180
  RSS_SOURCE_OPTIONS = [
181
  # General world news
182
- ("BBC World", "bbc_world"),
183
- ("Al Jazeera", "al_jazeera"),
184
- ("France 24", "france24"),
185
- ("NPR World", "npr_world"),
186
- ("Sky News", "sky_news"),
187
- ("UN News", "un_news"),
188
- # Regional / specialist
189
- ("Middle East Eye", "middle_east_eye"),
190
- ("Radio Free Asia", "radio_free_asia"),
 
 
 
 
 
 
 
 
 
 
 
 
191
  # OSINT / investigative
192
- ("Bellingcat", "bellingcat"),
193
- ("The Intercept", "the_intercept"),
194
- ("OCCRP", "occrp"),
195
  # Policy / security analysis
196
- ("Crisis Group", "crisis_group"),
197
- ("War on the Rocks", "war_on_rocks"),
198
- ("Just Security", "just_security"),
 
 
 
199
  # Human rights
200
- ("Human Rights Watch", "hrw"),
201
- ("Amnesty Intl", "amnesty"),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
  ]
203
 
204
  PASSPORT_COUNTRIES = [
@@ -251,10 +312,13 @@ with gr.Blocks(title="OSINT Threat Analyst", css=CSS, theme=gr.themes.Soft()) as
251
  with gr.Column(scale=1):
252
  gr.Markdown("### Configure Analysis")
253
 
254
- country_input = gr.Textbox(
 
 
255
  label="Country / Region of Interest",
256
- placeholder="e.g. Sudan, Myanmar, Haiti...",
257
- max_lines=1,
 
258
  )
259
 
260
  passport_input = gr.Dropdown(
 
75
  - Raw agent trace for transparency
76
  - ThreatBrief object (stored in gr.State for PDF export)
77
  """
78
+ if not country or not str(country).strip():
79
+ return "<p style='color:red'>Please select a country or region.</p>", "", None
80
+ country = str(country).strip()
81
 
82
  progress(0.1, desc="Initializing agent...")
83
 
 
180
 
181
  RSS_SOURCE_OPTIONS = [
182
  # General world news
183
+ ("BBC World", "bbc_world"),
184
+ ("Al Jazeera", "al_jazeera"),
185
+ ("France 24", "france24"),
186
+ ("Euronews", "euronews"),
187
+ ("NPR World", "npr_world"),
188
+ ("Sky News", "sky_news"),
189
+ ("UN News", "un_news"),
190
+ ("Intl Business Times", "ibt"),
191
+ # Regional: Middle East
192
+ ("Middle East Eye", "middle_east_eye"),
193
+ ("Al-Monitor", "al_monitor"),
194
+ ("Arab News", "arab_news"),
195
+ # Regional: Africa
196
+ ("AllAfrica", "allafrica"),
197
+ # Regional: Asia-Pacific
198
+ ("Radio Free Asia", "radio_free_asia"),
199
+ ("S. China Morning Post", "scmp"),
200
+ # Regional: South Asia
201
+ ("Dawn (Pakistan)", "dawn"),
202
+ # Regional: Russia / E. Europe
203
+ ("The Moscow Times", "moscow_times"),
204
  # OSINT / investigative
205
+ ("Bellingcat", "bellingcat"),
206
+ ("The Intercept", "the_intercept"),
207
+ ("OCCRP", "occrp"),
208
  # Policy / security analysis
209
+ ("Crisis Group", "crisis_group"),
210
+ ("War on the Rocks", "war_on_rocks"),
211
+ ("Just Security", "just_security"),
212
+ ("Defense One", "defense_one"),
213
+ ("The Cipher Brief", "cipher_brief"),
214
+ ("Stimson Center", "stimson"),
215
  # Human rights
216
+ ("Human Rights Watch", "hrw"),
217
+ ("Amnesty Intl", "amnesty"),
218
+ ]
219
+
220
+ DESTINATION_COUNTRIES = [
221
+ "Afghanistan", "Albania", "Algeria", "Andorra", "Angola", "Antigua and Barbuda",
222
+ "Argentina", "Armenia", "Australia", "Austria", "Azerbaijan",
223
+ "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize",
224
+ "Benin", "Bhutan", "Bolivia", "Bosnia and Herzegovina", "Botswana", "Brazil",
225
+ "Brunei", "Bulgaria", "Burkina Faso", "Burundi",
226
+ "Cabo Verde", "Cambodia", "Cameroon", "Canada", "Central African Republic", "Chad",
227
+ "Chile", "China", "Colombia", "Comoros", "Congo (Republic)", "Congo (DRC)",
228
+ "Costa Rica", "Croatia", "Cuba", "Cyprus", "Czech Republic",
229
+ "Denmark", "Djibouti", "Dominica", "Dominican Republic",
230
+ "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia",
231
+ "Eswatini", "Ethiopia",
232
+ "Fiji", "Finland", "France",
233
+ "Gabon", "Gambia", "Georgia", "Germany", "Ghana", "Greece", "Grenada",
234
+ "Guatemala", "Guinea", "Guinea-Bissau", "Guyana",
235
+ "Haiti", "Honduras", "Hungary",
236
+ "Iceland", "India", "Indonesia", "Iran", "Iraq", "Ireland", "Israel", "Italy",
237
+ "Jamaica", "Japan", "Jordan",
238
+ "Kazakhstan", "Kenya", "Kiribati", "Kosovo", "Kuwait", "Kyrgyzstan",
239
+ "Laos", "Latvia", "Lebanon", "Lesotho", "Liberia", "Libya", "Liechtenstein",
240
+ "Lithuania", "Luxembourg",
241
+ "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands",
242
+ "Mauritania", "Mauritius", "Mexico", "Micronesia", "Moldova", "Monaco", "Mongolia",
243
+ "Montenegro", "Morocco", "Mozambique", "Myanmar",
244
+ "Namibia", "Nauru", "Nepal", "Netherlands", "New Zealand", "Nicaragua", "Niger",
245
+ "Nigeria", "North Korea", "North Macedonia", "Norway",
246
+ "Oman",
247
+ "Pakistan", "Palau", "Palestine", "Panama", "Papua New Guinea", "Paraguay", "Peru",
248
+ "Philippines", "Poland", "Portugal",
249
+ "Qatar",
250
+ "Romania", "Russia", "Rwanda",
251
+ "Saint Kitts and Nevis", "Saint Lucia", "Saint Vincent and the Grenadines",
252
+ "Samoa", "San Marino", "Sao Tome and Principe", "Saudi Arabia", "Senegal",
253
+ "Serbia", "Seychelles", "Sierra Leone", "Singapore", "Slovakia", "Slovenia",
254
+ "Solomon Islands", "Somalia", "South Africa", "South Korea", "South Sudan", "Spain",
255
+ "Sri Lanka", "Sudan", "Suriname", "Sweden", "Switzerland", "Syria",
256
+ "Taiwan", "Tajikistan", "Tanzania", "Thailand", "Timor-Leste", "Togo", "Tonga",
257
+ "Trinidad and Tobago", "Tunisia", "Turkey", "Turkmenistan", "Tuvalu",
258
+ "Uganda", "Ukraine", "United Arab Emirates", "United Kingdom", "United States",
259
+ "Uruguay", "Uzbekistan",
260
+ "Vanuatu", "Vatican City", "Venezuela", "Vietnam",
261
+ "Yemen",
262
+ "Zambia", "Zimbabwe",
263
  ]
264
 
265
  PASSPORT_COUNTRIES = [
 
312
  with gr.Column(scale=1):
313
  gr.Markdown("### Configure Analysis")
314
 
315
+ country_input = gr.Dropdown(
316
+ choices=DESTINATION_COUNTRIES,
317
+ value=None,
318
  label="Country / Region of Interest",
319
+ info="Type to search and select the country you are researching or travelling to.",
320
+ filterable=True,
321
+ allow_custom_value=True,
322
  )
323
 
324
  passport_input = gr.Dropdown(
tools.py CHANGED
@@ -182,13 +182,29 @@ RSS_FEED_REGISTRY = {
182
  "bbc_world": "https://feeds.bbci.co.uk/news/world/rss.xml",
183
  "al_jazeera": "https://www.aljazeera.com/xml/rss/all.xml",
184
  "france24": "https://www.france24.com/en/rss",
 
185
  "npr_world": "https://feeds.npr.org/1004/rss.xml",
186
  "sky_news": "https://feeds.skynews.com/feeds/rss/world.xml",
187
  "un_news": "https://news.un.org/feed/subscribe/en/news/all/rss.xml",
 
188
 
189
- # --- Regional / specialist ---
190
  "middle_east_eye": "https://www.middleeasteye.net/rss",
 
 
 
 
 
 
 
191
  "radio_free_asia": "https://www.rfa.org/english/rss2.xml",
 
 
 
 
 
 
 
192
 
193
  # --- OSINT / investigative ---
194
  "bellingcat": "https://www.bellingcat.com/feed/",
@@ -199,6 +215,9 @@ RSS_FEED_REGISTRY = {
199
  "crisis_group": "https://www.crisisgroup.org/rss.xml",
200
  "war_on_rocks": "https://warontherocks.com/feed/",
201
  "just_security": "https://www.justsecurity.org/feed/",
 
 
 
202
 
203
  # --- Human rights ---
204
  "hrw": "https://www.hrw.org/rss.xml",
 
182
  "bbc_world": "https://feeds.bbci.co.uk/news/world/rss.xml",
183
  "al_jazeera": "https://www.aljazeera.com/xml/rss/all.xml",
184
  "france24": "https://www.france24.com/en/rss",
185
+ "euronews": "https://feeds.feedburner.com/euronews/en/news/",
186
  "npr_world": "https://feeds.npr.org/1004/rss.xml",
187
  "sky_news": "https://feeds.skynews.com/feeds/rss/world.xml",
188
  "un_news": "https://news.un.org/feed/subscribe/en/news/all/rss.xml",
189
+ "ibt": "https://www.ibtimes.com/rss",
190
 
191
+ # --- Regional: Middle East ---
192
  "middle_east_eye": "https://www.middleeasteye.net/rss",
193
+ "al_monitor": "https://www.almonitor.com/rss",
194
+ "arab_news": "https://www.arabnews.com/rss.xml",
195
+
196
+ # --- Regional: Africa ---
197
+ "allafrica": "https://allafrica.com/tools/headlines/rdf/latest/headlines.rdf",
198
+
199
+ # --- Regional: Asia-Pacific ---
200
  "radio_free_asia": "https://www.rfa.org/english/rss2.xml",
201
+ "scmp": "https://www.scmp.com/rss/91/feed",
202
+
203
+ # --- Regional: South Asia ---
204
+ "dawn": "https://www.dawn.com/feeds/home",
205
+
206
+ # --- Regional: Russia / Eastern Europe ---
207
+ "moscow_times": "https://www.themoscowtimes.com/rss/news",
208
 
209
  # --- OSINT / investigative ---
210
  "bellingcat": "https://www.bellingcat.com/feed/",
 
215
  "crisis_group": "https://www.crisisgroup.org/rss.xml",
216
  "war_on_rocks": "https://warontherocks.com/feed/",
217
  "just_security": "https://www.justsecurity.org/feed/",
218
+ "defense_one": "https://www.defenseone.com/rss/all/",
219
+ "cipher_brief": "https://www.thecipherbrief.com/feed",
220
+ "stimson": "https://www.stimson.org/feed/",
221
 
222
  # --- Human rights ---
223
  "hrw": "https://www.hrw.org/rss.xml",