sreelekhaputta2 commited on
Commit
4c076e4
·
verified ·
1 Parent(s): 66d0a97

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +137 -42
app.py CHANGED
@@ -11,38 +11,140 @@ projects = [
11
 
12
  css = """
13
  @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');
14
- * { font-family: 'Inter', sans-serif !important; color: white !important; box-sizing: border-box !important; }
15
- body, .gradio-container {
16
- margin: 0 !important; padding: 0 !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  background: linear-gradient(rgba(10,10,26,0.95), rgba(45,27,105,0.95)),
18
  url('https://tse4.explicit.bing.net/th/id/OIP.CSOmF_Va1tPzTClwWuugnwHaEK?pid=Api&h=220&P=0') center/cover !important;
19
- min-height: 100vh !important; overflow-x: hidden !important;
20
  }
21
 
22
- /* ULTRA FAST VIDEO CSS */
23
- .fast-video {
24
- width: 100% !important;
25
- height: auto !important;
26
- max-height: 250px !important;
27
- border-radius: 12px !important;
28
- box-shadow: 0 12px 25px rgba(0,0,0,0.4) !important;
29
- display: block !important;
30
- loading: lazy !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  }
32
 
33
- /* MOBILE PERFECT */
34
- .center-content { display: flex !important; flex-direction: column !important; align-items: center !important; text-align: center !important; width: 100vw !important; padding: 1rem !important; }
35
- .glass-card { background: rgba(255,255,255,0.2) !important; backdrop-filter: blur(25px) !important; border: 1px solid rgba(255,255,255,0.3) !important; border-radius: 16px !important; box-shadow: 0 15px 35px rgba(0,0,0,0.5) !important; padding: 1.2rem !important; margin: 0.5rem auto !important; width: 95vw !important; max-width: 600px !important; }
36
- .demo-btn { background: linear-gradient(135deg, #ff6b6b, #feca57) !important; color: white !important; padding: 1rem 2rem !important; border-radius: 12px !important; text-decoration: none !important; display: inline-block !important; font-weight: 600 !important; width: 85% !important; max-width: 300px !important; margin: 1rem auto !important; box-shadow: 0 10px 25px rgba(255,107,107,0.4) !important; }
37
- .header-gradient { background: linear-gradient(135deg, rgba(102,126,234,0.95), rgba(118,75,162,0.95)) !important; border-radius: 16px !important; padding: 2rem 1rem !important; margin: 1rem auto !important; max-width: 95vw !important; }
38
- .tab-button, .gradio-tabs { color: white !important; background: transparent !important; }
39
- @media (max-width: 480px) { .fast-video { max-height: 200px !important; } .glass-card { padding: 1rem !important; } }
40
- @media (min-width: 1025px) { .fast-video { max-height: 350px !important; } }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  """
42
 
43
  with gr.Blocks(css=css) as demo:
44
- gr.Markdown("# ✨ **AI/ML Projects**\n\n**6 Production-Ready Projects • Live Demos**", elem_classes="header-gradient glass-card center-content")
 
 
 
 
45
 
 
46
  with gr.Tabs(elem_classes="center-content"):
47
  for proj in projects:
48
  with gr.TabItem(proj["name"]):
@@ -51,30 +153,23 @@ with gr.Blocks(css=css) as demo:
51
  gr.Markdown(f"**📝 {proj['desc']}**")
52
  gr.Markdown(f"**🛠️ Tech Stack:** {' • '.join(proj['skills'])}")
53
 
54
- # ⚡ ULTRA-FAST LIVE BUTTON
55
  gr.HTML(f'''
56
- <div style="text-align:center; padding:0.5rem;">
57
  <a href="{proj['live']}" target="_blank" class="demo-btn" style="text-decoration:none;">
58
- 🎮 Launch Live Demo
59
  </a>
60
  </div>
61
  ''')
62
 
63
- # ⚡ LIGHTNING FAST VIDEO - 3 SECOND LOAD
64
- gr.HTML(f'''
65
- <div style="width:100%; text-align:center;">
66
- <video class="fast-video"
67
- controls
68
- preload="metadata"
69
- playsinline
70
- muted
71
- loading="lazy"
72
- poster="https://via.placeholder.com/640x360/1a1a3a/ffffff?text={proj['name']}+DEMO">
73
- <source src="{proj['video']}" type="video/mp4">
74
- <source src="{proj['video']}" type="video/webm">
75
- <p style="color:#ccc; font-size:0.9rem;">⚡ Tap to play ({proj['name']} demo)</p>
76
- </video>
77
- </div>
78
- ''')
79
 
80
- demo.launch(share=True, debug=True, show_error=True)
 
11
 
12
  css = """
13
  @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');
14
+
15
+ /* MOBILE SCROLL FIXED + CENTER */
16
+ * {
17
+ font-family: 'Inter', sans-serif !important;
18
+ color: white !important;
19
+ box-sizing: border-box !important;
20
+ max-width: 100% !important;
21
+ }
22
+
23
+ /* SCROLLABLE MOBILE */
24
+ html, body, .gradio-container {
25
+ margin: 0 !important;
26
+ padding: 0 !important;
27
+ height: auto !important;
28
+ min-height: 100vh !important;
29
+ overflow-x: hidden !important;
30
+ overflow-y: auto !important;
31
+ -webkit-overflow-scrolling: touch !important;
32
  background: linear-gradient(rgba(10,10,26,0.95), rgba(45,27,105,0.95)),
33
  url('https://tse4.explicit.bing.net/th/id/OIP.CSOmF_Va1tPzTClwWuugnwHaEK?pid=Api&h=220&P=0') center/cover !important;
 
34
  }
35
 
36
+ /* PERFECT MOBILE CENTER */
37
+ .center-content {
38
+ display: flex !important;
39
+ flex-direction: column !important;
40
+ align-items: center !important;
41
+ justify-content: flex-start !important;
42
+ text-align: center !important;
43
+ width: 100% !important;
44
+ max-width: 100% !important;
45
+ padding: 1rem !important;
46
+ margin: 0 auto !important;
47
+ min-height: 100vh !important;
48
+ }
49
+
50
+ /* MOBILE GLASS CARDS */
51
+ .glass-card {
52
+ background: rgba(255,255,255,0.2) !important;
53
+ backdrop-filter: blur(25px) !important;
54
+ border: 1px solid rgba(255,255,255,0.3) !important;
55
+ border-radius: 16px !important;
56
+ box-shadow: 0 15px 35px rgba(0,0,0,0.5) !important;
57
+ padding: 1.5rem !important;
58
+ margin: 1rem auto !important;
59
+ width: 95% !important;
60
+ max-width: 600px !important;
61
+ }
62
+
63
+ /* MOBILE BUTTONS */
64
+ .demo-btn {
65
+ background: linear-gradient(135deg, #ff6b6b, #feca57) !important;
66
+ color: white !important;
67
+ padding: 1rem 2rem !important;
68
+ border-radius: 12px !important;
69
+ text-decoration: none !important;
70
+ display: inline-block !important;
71
+ font-weight: 600 !important;
72
+ font-size: 1rem !important;
73
+ width: 85% !important;
74
+ max-width: 300px !important;
75
+ margin: 1rem auto !important;
76
+ box-shadow: 0 10px 25px rgba(255,107,107,0.4) !important;
77
+ transition: all 0.3s !important;
78
+ touch-action: manipulation !important;
79
+ }
80
+
81
+ /* HEADER */
82
+ .header-gradient {
83
+ background: linear-gradient(135deg, rgba(102,126,234,0.95), rgba(118,75,162,0.95)) !important;
84
+ border-radius: 16px !important;
85
+ padding: 2rem 1rem !important;
86
+ margin: 1rem auto !important;
87
+ max-width: 95% !important;
88
+ }
89
+
90
+ /* VIDEO RESPONSIVE */
91
+ .playable-video video {
92
+ width: 100% !important;
93
+ height: auto !important;
94
+ max-height: 280px !important;
95
+ border-radius: 12px !important;
96
+ margin: 1rem 0 !important;
97
  }
98
 
99
+ /* MOBILE TABS SCROLLABLE */
100
+ .gradio-tabs {
101
+ width: 100% !important;
102
+ max-width: 100% !important;
103
+ }
104
+ .tab-header {
105
+ display: flex !important;
106
+ flex-wrap: wrap !important;
107
+ justify-content: center !important;
108
+ overflow-x: auto !important;
109
+ background: transparent !important;
110
+ }
111
+ .tab-button {
112
+ color: white !important;
113
+ background: rgba(255,255,255,0.1) !important;
114
+ border: 1px solid rgba(255,255,255,0.3) !important;
115
+ margin: 0.2rem !important;
116
+ padding: 0.8rem 1rem !important;
117
+ white-space: nowrap !important;
118
+ min-height: 44px !important;
119
+ flex: 0 0 auto !important;
120
+ }
121
+
122
+ /* MOBILE SPECIFIC */
123
+ @media (max-width: 768px) {
124
+ .center-content { padding: 0.8rem !important; }
125
+ .glass-card { padding: 1.2rem !important; margin: 0.8rem auto !important; width: 98% !important; }
126
+ .playable-video video { max-height: 220px !important; }
127
+ .demo-btn { padding: 0.9rem 1.8rem !important; font-size: 0.95rem !important; }
128
+ .header-gradient { padding: 1.5rem 1rem !important; }
129
+ .tab-header { padding: 0.5rem !important; }
130
+ }
131
+
132
+ /* DESKTOP */
133
+ @media (min-width: 1025px) {
134
+ .glass-card { padding: 2.5rem !important; max-width: 800px !important; }
135
+ .playable-video video { max-height: 350px !important; }
136
+ .center-content { max-width: 1000px !important; padding: 2rem !important; }
137
+ }
138
  """
139
 
140
  with gr.Blocks(css=css) as demo:
141
+ # HEADER
142
+ gr.Markdown(
143
+ "# ✨ **AI/ML Projects**\n\n**6 Production-Ready Projects • Live on Hugging Face**",
144
+ elem_classes="header-gradient glass-card center-content"
145
+ )
146
 
147
+ # SCROLLABLE TABS
148
  with gr.Tabs(elem_classes="center-content"):
149
  for proj in projects:
150
  with gr.TabItem(proj["name"]):
 
153
  gr.Markdown(f"**📝 {proj['desc']}**")
154
  gr.Markdown(f"**🛠️ Tech Stack:** {' • '.join(proj['skills'])}")
155
 
156
+ # BUTTON
157
  gr.HTML(f'''
158
+ <div style="text-align:center; padding:1rem 0;">
159
  <a href="{proj['live']}" target="_blank" class="demo-btn" style="text-decoration:none;">
160
+ 🎮 Launch {proj['name']} Live Demo
161
  </a>
162
  </div>
163
  ''')
164
 
165
+ # VIDEO
166
+ gr.Video(
167
+ value=proj["video"],
168
+ label=f"📹 {proj['name']} Demo",
169
+ height=280,
170
+ interactive=False,
171
+ format="mp4",
172
+ elem_classes="playable-video"
173
+ )
 
 
 
 
 
 
 
174
 
175
+ demo.launch(share=True, debug=True, show_error=True, css=css)