Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| import pandas as pd | |
| import plotly.express as px | |
| import plotly.graph_objects as go | |
| import numpy as np | |
| import random | |
| import feedparser | |
| import os | |
| from datetime import datetime, timedelta | |
| ################################################################# | |
| # I. AUTHORIZATION & TACTICAL DATA (LOCKED) | |
| ################################################################# | |
| AUTHORIZED_VIEWERS = [ | |
| ("Admin", "daddy5820"), ("GOC", "goc1111"), ("Patrick", "patxxxx"), | |
| ("GENERAL", "gen2222"), ("Officer", "officer0000") | |
| ] | |
| # GLOBAL FEED REGISTRY (Verified Streams) | |
| RSS_FEEDS = { | |
| "REUTERS": "https://www.reutersagency.com/feed/", | |
| "BBC (UK)": "https://feeds.bbci.co.uk/news/world/rss.xml", | |
| "AP NEWS (USA)": "https://news.google.com/rss/search?q=Associated+Press+World", | |
| "TASS (Russia)": "https://tass.com/rss/v2.xml", | |
| "HAARETZ (Israel)": "https://www.haaretz.com/cmlink/1.1470", | |
| "IRNA (Iran)": "https://en.irna.ir/rss", | |
| "NDTV (India)": "https://feeds.feedburner.com/ndtvnews-top-stories", | |
| "AL JAZEERA": "https://www.aljazeera.com/xml/rss/all.xml" | |
| } | |
| # Core OSINT Data Points | |
| TR_DATA = { | |
| "Hormuz (TR-1)": 95, "Proxy (TR-2)": 88, | |
| "Dubai/UAE (TR-3)": 98, "Nuclear (TR-4)": 85 | |
| } | |
| NODES = { | |
| "Tehran (Launch)": [35.6, 51.3], "Isfahan (Nuclear)": [32.6, 51.6], | |
| "Haifa (Naval Base)": [32.8, 34.9], "Ras Tanura (Energy)": [26.6, 50.1], | |
| "Jebel Ali (Port)": [25.0, 55.0], "Beirut (Dahiyeh)": [33.8, 35.5] | |
| } | |
| ################################################################# | |
| # II. INTELLIGENCE FETCH ENGINE (AUTO-SYNC) | |
| ################################################################# | |
| def fetch_live_intelligence(): | |
| """Parses international news feeds and returns structured HTML.""" | |
| integrated_html = "<div style='font-family: monospace;'>" | |
| for agency, url in RSS_FEEDS.items(): | |
| try: | |
| feed = feedparser.parse(url) | |
| top_stories = feed.entries[:3] | |
| integrated_html += f"<div style='margin-bottom: 12px; border-left: 4px solid #7B0000; padding-left: 10px;'>" | |
| integrated_html += f"<b style='color: #7B0000; text-transform: uppercase;'>[{agency}]</b><br>" | |
| for entry in top_stories: | |
| integrated_html += f"<a href='{entry.link}' target='_blank' style='color: black; text-decoration: none; font-weight: bold;'>• {entry.title}</a><br>" | |
| integrated_html += "</div>" | |
| except: | |
| integrated_html += f"<div style='color: #999; font-size: 11px;'>[{agency}] SYNC TEMPORARILY OFFLINE</div>" | |
| return integrated_html + "</div>" | |
| ################################################################# | |
| # III. GRAPHICS ENGINES (RESTORED & VERIFIED) | |
| ################################################################# | |
| def generate_warning_clock(): | |
| categories = list(TR_DATA.keys()) | |
| values = list(TR_DATA.values()) | |
| categories += [categories[0]]; values += [values[0]] | |
| fig = go.Figure() | |
| fig.add_trace(go.Scatterpolar(r=values, theta=categories, fill='toself', | |
| fillcolor='rgba(123, 0, 0, 0.4)', line=dict(color='red', width=4))) | |
| fig.update_layout(polar=dict(bgcolor="black", radialaxis=dict(visible=True, range=[0, 100], gridcolor="#444")), | |
| showlegend=False, paper_bgcolor="black", height=320, title=dict(text="MILITARY WARNING CLOCK", font=dict(color="red"), x=0.5)) | |
| return fig | |
| def advanced_missile_corridors(): | |
| fig = go.Figure() | |
| corridors = [("Tehran (Launch)", "Haifa (Naval Base)", "Direct Ballistic", "red"), | |
| ("Isfahan (Nuclear)", "Ras Tanura (Energy)", "Drone Swarm", "orange"), | |
| ("Tehran (Launch)", "Jebel Ali (Port)", "Cruise Missile", "red")] | |
| for start, end, tech, color in corridors: | |
| lat1, lon1 = NODES[start]; lat2, lon2 = NODES[end] | |
| fig.add_trace(go.Scattergeo(lat=[lat1, lat2], lon=[lon1, lon2], mode="lines+markers", | |
| line=dict(width=3, color=color, dash='dot'), name=tech)) | |
| fig.update_layout(geo=dict(projection_type="orthographic", showland=True, landcolor="#111", | |
| center=dict(lat=30, lon=45), projection_scale=3), | |
| paper_bgcolor="black", margin=dict(l=0, r=0, t=40, b=0), height=380) | |
| return fig | |
| def generate_wave_9_forecast(): | |
| days = [f"Mar {11+i}" for i in range(14)] | |
| risk_values = [88, 90, 95, 98, 97, 99, 100, 100, 98, 96, 95, 94, 93, 92] | |
| df = pd.DataFrame({"Date": days, "Escalation Index": risk_values}) | |
| fig = px.area(df, x="Date", y="Escalation Index", title="WAVE-9 PREDICTIVE MODEL", color_discrete_sequence=['red']) | |
| fig.update_layout(paper_bgcolor="black", plot_bgcolor="black", font=dict(color="red"), height=380) | |
| return fig | |
| def generate_us_navy_posture(): | |
| metrics = ["Strike Readiness", "Counter-Mine Alpha", "Escort Prob", "ROE Lethality"] | |
| intensity = [98, 92, 45, 95] | |
| fig = go.Figure(go.Bar(x=intensity, y=metrics, orientation='h', marker=dict(color=['#000080', '#c0c0c0', '#4169e1', '#b22222']))) | |
| fig.update_layout(title="USN TACTICAL POSTURE", paper_bgcolor="black", plot_bgcolor="black", font=dict(color="white"), height=280) | |
| return fig | |
| def generate_r3_index(): | |
| regions = ["UAE", "Saudi Arabia", "Bahrain", "Qatar", "Kuwait/Oman"] | |
| df = pd.DataFrame({"Region": regions, "Resentment": [92, 89, 75, 65, 55], "Retaliation": [85, 94, 60, 40, 30]}) | |
| fig = px.bar(df, x="Region", y=["Resentment", "Retaliation"], barmode="group", color_discrete_map={"Resentment": "crimson", "Retaliation": "gold"}) | |
| fig.update_layout(title="R3I: REGIONAL RESENTMENT INDEX", paper_bgcolor="black", plot_bgcolor="black", font=dict(color="white"), height=280) | |
| return fig | |
| ################################################################# | |
| # IV. MAIN INTERFACE (FULL 200+ LINE STRUCTURE) | |
| ################################################################# | |
| with gr.Blocks(theme=gr.themes.Monochrome()) as app: | |
| # 1. PERMANENT HEADER & THREAT BARS | |
| gr.HTML("<div style='background: #000; color: white; text-align: center; padding: 15px; font-weight: bold; border-bottom: 5px solid #7B0000;'>VERIFIED INTELLIGENCE FEED: REUTERS | IAEA | AP | TASS | IRNA | NDTV SYNCHRONIZED</div>") | |
| with gr.Row(): | |
| for color, label in [("#FF0000", "SEVERE (ACTIVE)"), ("#FF8C00", "HIGH"), ("#0000FF", "GUARDED"), ("#008000", "LOW")]: | |
| gr.HTML(f"<div style='flex: 1; background: {color}; border: 2px solid #000; color: white; text-align: center; font-weight: bold;'>{label}</div>") | |
| # 2. BELLIGERENT INTENT MATRIX (RESTORED 4-INTENT ROW) | |
| gr.Markdown("## I. BELLIGERENT INTENT MATRIX (ORDER OF PRIORITY)") | |
| with gr.Row(): | |
| with gr.Column(): gr.Markdown("### 🇮🇷 IRAN\n1. Survival\n2. Hormuz Dominance\n3. Nuclear Breakout\n4. Dubai Decapitation") | |
| with gr.Column(): gr.Markdown("### 🇺🇸 USA\n1. Deterrence\n2. Base Usage Security\n3. Energy Security\n4. Base Protection") | |
| with gr.Column(): gr.Markdown("### 🇮🇱 ISRAEL\n1. Threat Neutralization\n2. Nuclear Sabotage\n3. Proxy Degradation\n4. Sovereign Defense") | |
| with gr.Column(): gr.Markdown("### 🇦🇪 GCC\n1. Infrastructure Safety\n2. Economic Continuity\n3. US Base Usage Limits\n4. Diplomatic Exit") | |
| # 3. GLOBAL FEED HUB & ANALYSIS | |
| gr.Markdown("## II. GLOBAL INTELLIGENCE & ANALYSIS") | |
| with gr.Row(): | |
| with gr.Column(scale=2): | |
| intel_feed = gr.HTML(value=fetch_live_intelligence) | |
| with gr.Column(scale=1): | |
| # Restored Special Analysis | |
| gr.HTML(""" | |
| <div style="color: black; font-family: monospace; background: white; padding: 20px; border: 5px solid #7B0000; height: 400px; overflow-y: scroll;"> | |
| <h3 style="color: #7B0000;">DUBAI COLLAPSE: TACTICAL ASSESSMENT</h3> | |
| <p><b>ALERT:</b> Mass exodus of foreign nationals confirmed. Strike density localized to 66%. Systemic flight tendency at critical threshold.</p> | |
| <p><b>STRATEGIC BRIEF:</b> Verification of enrichment holding at 60%. IAEA reports focus shift to naval corridors.</p> | |
| </div> | |
| """) | |
| # 4. PRIMARY GRAPHICS (CLOCK & CORRIDORS) | |
| gr.Markdown("## III. KINETIC VECTORS & ESCALATION") | |
| with gr.Row(): | |
| clock_panel = gr.Plot(value=generate_warning_clock()) | |
| vector_plot = gr.Plot(value=advanced_missile_corridors()) | |
| # 5. PREDICTIVE ESCALATION & BASE VULNERABILITY (RESTORED) | |
| gr.Markdown("## IV. TRIGGER BRIEFING & FORECAST") | |
| with gr.Row(): | |
| with gr.Column(): | |
| gr.Markdown("### PREDICTIVE ESCALATION TIMELINE") | |
| gr.Markdown("* **Phase 1:** Proxy Saturation (Current | 95% Chance)\n* **Phase 2:** Wave-9 Kinetic Strike (T+48H | 88% Chance)\n* **Phase 3:** Total Systemic Break (T+14D | 98% Chance)") | |
| gr.Markdown("### REGIONAL US BASE VULNERABILITY") | |
| gr.Markdown("* **Bahrain:** Usage 95% | Vuln: MAX\n* **UAE/Dubai:** Usage 98% | Vuln: TERMINAL\n* **Saudi Arabia:** Usage 65% | Vuln: MODERATE") | |
| with gr.Column(): | |
| wave_plot = gr.Plot(value=generate_wave_9_forecast()) | |
| # 6. OPERATIONAL ANALYTICS (NAVY & R3I) | |
| gr.Markdown("## V. OPERATIONAL ANALYTICS") | |
| with gr.Row(): | |
| navy_panel = gr.Plot(value=generate_us_navy_posture()) | |
| r3i_panel = gr.Plot(value=generate_r3_index()) | |
| # 7. RED TRIGGER STATUS | |
| gr.Markdown("### VI. TRIGGER STATUS MONITOR") | |
| gr.Markdown(f"* **TR-1 (Hormuz):** {TR_DATA['Hormuz (TR-1)']}% \n* **TR-2 (Proxy):** {TR_DATA['Proxy (TR-2)']}% \n* **TR-3 (Dubai):** {TR_DATA['Dubai/UAE (TR-3)']}% EXODUS \n* **TR-4 (Nuclear):** {TR_DATA['Nuclear (TR-4)']}%") | |
| # 8. MASTER INTELLIGENCE SUMMARY | |
| gr.Markdown("## VII. MASTER INTELLIGENCE SUMMARY") | |
| gr.HTML(""" | |
| <div style="color: black; font-family: monospace; background: white; padding: 25px; border: 4px solid #000; height: 180px; overflow-y: scroll;"> | |
| <b>INTEGRATED REPORT [MAR 12]:</b> The theater has reached an inflection point. Wave-9 escalation has pivoted toward a focused Dubai Economic Decapitation. Strike density localized to 66% of regional activity. | |
| </div> | |
| """) | |
| # AUTO-REFRESH BUTTON | |
| run_btn = gr.Button("RE-SYNC ALL CHANNELS", variant="primary", size="lg") | |
| def master_refresh(): | |
| return [fetch_live_intelligence(), generate_warning_clock(), advanced_missile_corridors(), | |
| generate_wave_9_forecast(), generate_us_navy_posture(), generate_r3_index()] | |
| run_btn.click(fn=master_refresh, outputs=[intel_feed, clock_panel, vector_plot, wave_plot, navy_panel, r3i_panel]) | |
| app.load(fn=master_refresh, outputs=[intel_feed, clock_panel, vector_plot, wave_plot, navy_panel, r3i_panel]) | |
| if __name__ == "__main__": | |
| app.launch(auth=AUTHORIZED_VIEWERS, server_name="0.0.0.0") |