Jofax commited on
Commit
cc26c42
·
verified ·
1 Parent(s): ebb8d8f

Upload 5 files

Browse files
Files changed (5) hide show
  1. App.y (2).txt +91 -0
  2. README (1).md +12 -0
  3. app (1).py +81 -0
  4. gitattributes (1).txt +35 -0
  5. requirements.txt +6 -0
App.y (2).txt ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import pandas as pd
3
+ from datetime import datetime
4
+
5
+ # --- MODERN LIGHTWEIGHT CSS (2026 GLASSMORPHISM STYLE) ---
6
+ theme_css = """
7
+ :root {
8
+ --accent: #00ADEE; /* Maldives Sea Blue */
9
+ --surface: #ffffff;
10
+ --text-main: #1A202C;
11
+ --glass: rgba(255, 255, 255, 0.8);
12
+ }
13
+ .gradio-container { background-color: #F7FAFC !important; font-family: 'Inter', sans-serif !important; }
14
+ .filter-card { background: var(--glass); backdrop-filter: blur(10px); border-radius: 12px; padding: 20px; border: 1px solid #E2E8F0; }
15
+ .hotel-card { border: 1px solid #E2E8F0; border-radius: 12px; transition: 0.3s; }
16
+ .hotel-card:hover { transform: translateY(-3px); box-shadow: 0 10px 20px rgba(0,0,0,0.05); }
17
+ .verified-badge { background: #E3FCEF; color: #006644; padding: 2px 8px; border-radius: 4px; font-size: 0.75em; font-weight: bold; }
18
+ """
19
+
20
+ # --- MOCK DATABASE ---
21
+ initial_data = [
22
+ {"ID": 1, "Name": "Velana Transit Day Inn", "Atoll": "Kaafu", "Location": "Hulhumale", "Price": 800, "Status": "Available", "Verified": True, "Contact": "+960 7771234"},
23
+ {"ID": 2, "Name": "Maafushi Sunset View", "Atoll": "Kaafu", "Location": "Maafushi", "Price": 1200, "Status": "Available", "Verified": True, "Contact": "+960 7775566"},
24
+ ]
25
+ db = pd.DataFrame(initial_data)
26
+
27
+ # --- LOGIC ---
28
+ def register_property(name, location, price, license_img):
29
+ # In a real app, license_img would be processed by an OCR/Admin
30
+ return f"✨ Request received for **{name}**. Our team will verify your license within 24 hours."
31
+
32
+ def filter_results(query):
33
+ if not query: return db
34
+ return db[db['Location'].str.contains(query, case=False) | db['Atoll'].str.contains(query, case=False)]
35
+
36
+ # --- UI LAYOUT ---
37
+ with gr.Blocks(css=theme_css, title="Maldives Direct") as demo:
38
+ gr.HTML("""
39
+ <div style="text-align: center; padding: 20px;">
40
+ <h1 style="color: #00ADEE; font-size: 2.5em; margin-bottom: 0;">MALDIVES DIRECT</h1>
41
+ <p style="color: #718096;">Verified Accommodations • Direct Owner Contact • 0% Commission</p>
42
+ </div>
43
+ """)
44
+
45
+ with gr.Tabs() as main_tabs:
46
+ # CUSTOMER INTERFACE
47
+ with gr.Tab("🏝️ Find a Room"):
48
+ with gr.Row(elem_classes="filter-card"):
49
+ search_input = gr.Textbox(placeholder="Search Island, Atoll or Hotel...", label="Where are you heading?", scale=4)
50
+ filter_btn = gr.Button("🔍 Search", variant="primary", scale=1)
51
+
52
+ results_table = gr.Dataframe(
53
+ value=db,
54
+ headers=["Name", "Atoll", "Location", "Price (MVR)", "Status", "Contact"],
55
+ datatype=["markdown", "str", "str", "number", "str", "str"],
56
+ interactive=False,
57
+ wrap=True
58
+ )
59
+
60
+ # OWNER INTERFACE (SELF-REGISTRATION)
61
+ with gr.Tab("🏨 For Owners"):
62
+ with gr.Row():
63
+ with gr.Column(scale=1):
64
+ gr.Markdown("### 🚀 Register Your Property\nJoin the 0% commission movement.")
65
+ reg_name = gr.Textbox(label="Property Name")
66
+ reg_loc = gr.Dropdown(choices=["Male'", "Hulhumale", "Maafushi", "Thulusdhoo", "Dhiffushi"], label="Location")
67
+ reg_price = gr.Number(label="Base Price per Night (MVR)")
68
+ reg_license = gr.Image(label="Upload MOT License / ID Card", type="filepath")
69
+ reg_btn = gr.Button("Submit for Verification", variant="primary")
70
+ reg_output = gr.Markdown()
71
+
72
+ with gr.Column(scale=1):
73
+ gr.HTML("""
74
+ <div style="background: #EBF8FF; padding: 20px; border-radius: 12px; border-left: 5px solid #3182CE;">
75
+ <h4 style="margin-top:0;">Why list with us?</h4>
76
+ <ul style="color: #2C5282; line-height: 1.6;">
77
+ <li><b>Instant Payouts:</b> Guests pay you directly.</li>
78
+ <li><b>Verified Trust:</b> Every listing is vetted by locals.</li>
79
+ <li><b>Low Flat Fee:</b> No commission, just a small monthly sub.</li>
80
+ </ul>
81
+ </div>
82
+ """)
83
+
84
+ # --- ACTIONS ---
85
+ filter_btn.click(fn=filter_results, inputs=search_input, outputs=results_table)
86
+ reg_btn.click(fn=register_property, inputs=[reg_name, reg_loc, reg_price, reg_license], outputs=reg_output)
87
+
88
+ gr.HTML("<p style='text-align:center; color: #A0AEC0; padding: 20px;'>© 2026 Maldives Direct - Empowering Local Hospitality</p>")
89
+
90
+ if __name__ == "__main__":
91
+ demo.launch()
README (1).md ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Gstay
3
+ emoji: 📊
4
+ colorFrom: blue
5
+ colorTo: yellow
6
+ sdk: gradio
7
+ sdk_version: 6.5.1
8
+ app_file: app.py
9
+ pinned: false
10
+ ---
11
+
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app (1).py ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import pandas as pd
3
+ import folium
4
+ from datetime import datetime
5
+
6
+ # --- ENHANCED LOCAL DATA ---
7
+ def get_live_data():
8
+ # In a production app, this would fetch from FollowMe/MTCC APIs
9
+ return pd.DataFrame([
10
+ {"id": "AZ1", "name": "Aanu Quick", "atoll": "Kaafu", "status": "Moving", "eta": "14:10", "lat": 4.1755, "lon": 73.5093, "sea_condition": "Calm"},
11
+ {"id": "CE2", "name": "Coral Express", "atoll": "Alif Alif", "status": "Delayed", "eta": "15:30", "lat": 4.1910, "lon": 73.5200, "sea_condition": "Moderate"},
12
+ {"id": "DH3", "name": "Dhon Hiri", "atoll": "Baa", "status": "Docked", "eta": "N/A", "lat": 4.2100, "lon": 73.5350, "sea_condition": "Calm"},
13
+ {"id": "AD4", "name": "Altec Dash", "atoll": "Kaafu", "status": "Moving", "eta": "14:05", "lat": 4.1850, "lon": 73.5150, "sea_condition": "Calm"}
14
+ ])
15
+
16
+ # --- UI LOGIC ---
17
+ def pulse_dashboard(search=""):
18
+ df = get_live_data()
19
+ if search:
20
+ df = df[df['name'].str.contains(search, case=False) | df['atoll'].str.contains(search, case=False)]
21
+
22
+ # Generate Map
23
+ m = folium.Map(location=[4.1755, 73.5093], zoom_start=12, tiles="cartodbpositron")
24
+ for _, b in df.iterrows():
25
+ color = "blue" if b['status'] == "Moving" else "orange"
26
+ folium.Marker(
27
+ [b['lat'], b['lon']],
28
+ popup=f"<b>{b['name']}</b><br>ETA: {b['eta']}",
29
+ icon=folium.Icon(color=color, icon="ship", prefix="fa")
30
+ ).add_to(m)
31
+
32
+ # AI Recommendation Logic
33
+ rec = "💡 No rush! Your favorited boats are on time."
34
+ if "Delayed" in df.values:
35
+ rec = "⚠️ Alert: Some routes are delayed due to 1.5m swells near Kaafu."
36
+
37
+ return m._repr_html_(), df[['name', 'atoll', 'status', 'eta', 'sea_condition']], rec
38
+
39
+ # --- THE "LIQUID GLASS" CSS ---
40
+ custom_css = """
41
+ .gradio-container {
42
+ background: url('https://images.unsplash.com/photo-1514282401047-d79a71a590e8?q=80&w=2000') no-repeat center center fixed !important;
43
+ background-size: cover !important;
44
+ }
45
+ .glass-panel {
46
+ background: rgba(255, 255, 255, 0.15) !important;
47
+ backdrop-filter: blur(15px) !important;
48
+ border-radius: 25px !important;
49
+ border: 1px solid rgba(255, 255, 255, 0.3) !important;
50
+ padding: 20px !important;
51
+ color: white !important;
52
+ }
53
+ #title-text { font-family: 'Outfit', sans-serif; text-shadow: 2px 2px 4px rgba(0,0,0,0.3); }
54
+ button.primary { background: linear-gradient(90deg, #00B4D8, #0077B6) !important; border: none !important; }
55
+ """
56
+
57
+ with gr.Blocks(css=custom_css, title="IslandPulse Maldives") as demo:
58
+ with gr.Column(elem_classes="glass-panel"):
59
+ gr.HTML("<h1 id='title-text' style='color: white; text-align: center;'>🏝️ IslandPulse Maldives</h1>")
60
+ gr.HTML("<p style='color: white; text-align: center;'>The Golden Standard for Maldivian Connectivity</p>")
61
+
62
+ with gr.Row():
63
+ search_box = gr.Textbox(label="🔍 Search Boat or Atoll", placeholder="e.g. 'Maafushi' or 'RTL'", show_label=False)
64
+ ai_info = gr.Markdown("✨ *AI Insights: Fetching sea conditions...*")
65
+
66
+ with gr.Row():
67
+ with gr.Column(scale=2):
68
+ map_view = gr.HTML()
69
+ with gr.Column(scale=1):
70
+ gr.Markdown("### 🚢 Fleet Overview")
71
+ fleet_table = gr.Dataframe(interactive=False)
72
+ ticket_btn = gr.Button("🎟️ Book Instant Ticket", variant="primary")
73
+ pay_notif = gr.Markdown("")
74
+
75
+ # Interaction Logic
76
+ search_box.change(pulse_dashboard, inputs=search_box, outputs=[map_view, fleet_table, ai_info])
77
+ ticket_btn.click(lambda: "✅ **Ticket Generated!** Scan your QR code at the jetty.", outputs=pay_notif)
78
+
79
+ demo.load(pulse_dashboard, outputs=[map_view, fleet_table, ai_info])
80
+
81
+ demo.launch()
gitattributes (1).txt ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
requirements.txt ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ gradio
2
+ pandas
3
+ folium
4
+ requests
5
+ beautifulsoup4
6
+ plotly