Dhn / App.py
Jofax's picture
Update App.py
333bb85 verified
import gradio as gr
import pandas as pd
# Mock database of "Sea-Pass" subscribers and vessel intelligence
SUBSCRIBERS = {"user_777": {"status": "Active", "tier": "Plus"}}
VESSEL_INTEL = {
"Ice-9": {"load": "85% Full", "eta": "14:20", "speed": "12 kts", "contact": "7781552"},
"Kinaaraa": {"load": "4 Seats Left", "eta": "15:05", "speed": "32 kts", "contact": "7776406"},
"Island 1": {"load": "Boarding Now", "eta": "13:50", "speed": "34 kts", "contact": "7772658"}
}
def get_premium_intel(vessel_name, user_id):
"""
Checks subscription status and returns high-value vessel data.
"""
user = SUBSCRIBERS.get(user_id, {"status": "Free"})
if user['status'] != "Active":
return "πŸ”’ UPGRADE REQUIRED: Pay 50 MVR/mo for Live ETA & Load Data."
data = VESSEL_INTEL.get(vessel_name, "Data Unavailable")
return f"βœ… PREMIUM INTEL for {vessel_name}:\n- Load: {data['load']}\n- Speed: {data['speed']}\n- Direct Line: {data['contact']}"
# Futuristic "Liquid Glass" Interface Design
custom_css = """
.gradio-container { background: #0b0f19; color: #00f2ff; font-family: 'Inter', sans-serif; }
.glass-panel {
background: rgba(255, 255, 255, 0.05);
backdrop-filter: blur(15px);
border: 1px solid rgba(0, 242, 255, 0.2);
border-radius: 20px;
padding: 20px;
}
"""
with gr.Blocks(css=custom_css) as demo:
gr.Markdown("# 🌊 ODIGO: SEA-PASS CONTROL CENTER")
with gr.Column(elem_classes="glass-panel"):
user_id = gr.Textbox(label="Enter User ID (Try: user_777)", placeholder="guest_001")
vessel = gr.Dropdown(choices=list(VESSEL_INTEL.keys()), label="Select Vessel")
intel_output = gr.Textbox(label="Vessel Status", interactive=False)
pay_btn = gr.Button("Fetch Live Data", variant="primary")
pay_btn.click(get_premium_intel, inputs=[vessel, user_id], outputs=intel_output)
demo.launch()