sreelekhaputta2 commited on
Commit
aee1c72
·
verified ·
1 Parent(s): 36461fb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +66 -66
app.py CHANGED
@@ -1,12 +1,12 @@
1
  import gradio as gr
2
 
3
  projects = [
4
- {"name": "Idealyze", "desc": "AI-powered content optimization platform", "skills": ["NLP", "Transformers", "FastAPI"], "live": "https://huggingface.co/spaces/sreelekhaputta2/Idealyze", "video": "Idealyze.mp4"},
5
- {"name": "DivineLoop", "desc": "Real-time audio-visual looping generator", "skills": ["Audio Processing", "Computer Vision", "WebRTC"], "live": "https://huggingface.co/spaces/sreelekhaputta2/DivineLoop", "video": "Divineloop.mp4"},
6
- {"name": "GenDoc_AI", "desc": "Intelligent PDF document generation", "skills": ["LLMs", "PDF Generation", "LangChain"], "live": "https://huggingface.co/spaces/sreelekhaputta2/GenDoc_AI", "video": "GendocAI.mp4"},
7
- {"name": "LinkShield", "desc": "Advanced URL security threat detection", "skills": ["Cybersecurity", "API Integration", "FastAPI"], "live": "https://huggingface.co/spaces/sreelekhaputta2/LinkShield", "video": "Linkshield.mp4"},
8
- {"name": "Chatbot", "desc": "Multi-modal conversational AI with memory", "skills": ["LLMs", "RAG", "Vector DB"], "live": "https://huggingface.co/spaces/sreelekhaputta2/Chatbot", "video": "Wiseverse.mp4"},
9
- {"name": "AvatarVerse", "desc": "Photorealistic AI avatar generator", "skills": ["Stable Diffusion", "ControlNet", "GANs"], "live": "https://huggingface.co/spaces/sreelekhaputta2/AvatarVerse", "video": "Avatarverse.mp4"}
10
  ]
11
 
12
  css = """
@@ -14,35 +14,19 @@ css = """
14
 
15
  * { font-family: 'Inter', sans-serif !important; }
16
 
17
- body {
18
- margin: 0 !important;
19
- padding: 0 !important;
20
- overflow-x: hidden !important;
21
- }
22
 
23
- .gradio-container {
24
- background: none !important;
25
- position: relative !important;
26
- min-height: 100vh !important;
27
- }
28
 
29
  #background-video {
30
- position: fixed !important;
31
- top: 0 !important;
32
- left: 0 !important;
33
- width: 100vw !important;
34
- height: 100vh !important;
35
- object-fit: cover !important;
36
- z-index: -2 !important;
37
- pointer-events: none !important;
38
  }
39
 
40
  .video-overlay {
41
- position: fixed !important;
42
- top: 0 !important;
43
- left: 0 !important;
44
- width: 100vw !important;
45
- height: 100vh !important;
46
  background: linear-gradient(rgba(15,15,35,0.85), rgba(45,27,105,0.85)) !important;
47
  z-index: -1 !important;
48
  }
@@ -56,27 +40,19 @@ body {
56
  }
57
 
58
  .center-content {
59
- display: flex !important;
60
- flex-direction: column !important;
61
- align-items: center !important;
62
- text-align: center !important;
63
  justify-content: center !important;
64
  }
65
 
66
  .demo-btn {
67
  background: linear-gradient(135deg, #ff6b6b, #feca57) !important;
68
- border: none !important;
69
- border-radius: 16px !important;
70
- color: white !important;
71
- font-weight: 600 !important;
72
- padding: 1.2rem 2.5rem !important;
73
- font-size: 1.1rem !important;
74
- width: 100% !important;
75
- max-width: 350px !important;
76
- margin: 1rem auto !important;
77
- transition: all 0.3s ease !important;
78
- text-decoration: none !important;
79
- display: inline-block !important;
80
  text-align: center !important;
81
  }
82
 
@@ -85,32 +61,58 @@ body {
85
  box-shadow: 0 20px 40px rgba(255, 107, 107, 0.4) !important;
86
  }
87
 
88
- .video-medium {
89
- height: 350px !important;
90
- max-width: 100% !important;
91
- width: 650px !important;
92
- border-radius: 16px !important;
 
 
 
 
93
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3) !important;
 
 
 
 
 
 
 
 
 
 
 
94
  }
95
 
96
  .header-gradient {
97
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
98
- border-radius: 24px !important;
99
- padding: 2.5rem !important;
100
- text-align: center !important;
101
- box-shadow: 0 25px 50px rgba(102, 126, 234, 0.4) !important;
102
  }
103
 
104
  @media (max-width: 768px) {
105
  .demo-btn { padding: 1rem 2rem !important; font-size: 1rem !important; }
106
- .video-medium { height: 280px !important; width: 100% !important; }
107
  }
108
  """
109
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  with gr.Blocks() as demo:
111
  # Background Video
112
  gr.HTML("""
113
- <video autoplay muted loop id="background-video">
114
  <source src="bg.mp4" type="video/mp4">
115
  </video>
116
  <div class="video-overlay"></div>
@@ -120,7 +122,10 @@ with gr.Blocks() as demo:
120
  with gr.Row(variant="compact", elem_classes="center-content"):
121
  gr.HTML("""
122
  <div class="header-gradient glass-card">
123
- <h1 style="margin: 0; font-weight: 800; font-size: 3rem; background: linear-gradient(135deg, #ffffff 0%, #e0e7ff 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;">
 
 
 
124
  ✨ AI/ML Projects
125
  </h1>
126
  <p style="margin: 1rem 0 0 0; font-size: 1.3rem; opacity: 0.9;">
@@ -129,7 +134,7 @@ with gr.Blocks() as demo:
129
  </div>
130
  """)
131
 
132
- # Project Tabs
133
  with gr.Tabs():
134
  for proj in projects:
135
  with gr.TabItem(proj["name"]):
@@ -139,18 +144,13 @@ with gr.Blocks() as demo:
139
  gr.Markdown(f"**🛠️ Tech Stack:** {' • '.join(proj['skills'])}")
140
 
141
  gr.HTML(f'''
142
- <a href="{proj["live"]}" target="_blank" class="demo-btn" style="display: inline-block; text-align: center; line-height: 1.5;">
143
  🎮 Launch {proj['name']} Live Demo
144
  </a>
145
  ''')
146
 
147
- gr.Video(
148
- value=proj["video"],
149
- label="📹 Project Demo",
150
- height=350,
151
- interactive=False,
152
- elem_classes="video-medium"
153
- )
154
 
155
  demo.launch(
156
  share=True,
 
1
  import gradio as gr
2
 
3
  projects = [
4
+ {"name": "Idealyze", "desc": "AI-powered content optimization platform", "skills": ["NLP", "Transformers", "FastAPI"], "live": "https://huggingface.co/spaces/sreelekhaputta2/Idealyze", "video": "Idealyze.mp4", "thumb": "Idealyze_thumb.jpg"},
5
+ {"name": "DivineLoop", "desc": "Real-time audio-visual looping generator", "skills": ["Audio Processing", "Computer Vision", "WebRTC"], "live": "https://huggingface.co/spaces/sreelekhaputta2/DivineLoop", "video": "Divineloop.mp4", "thumb": "Divineloop_thumb.jpg"},
6
+ {"name": "GenDoc_AI", "desc": "Intelligent PDF document generation", "skills": ["LLMs", "PDF Generation", "LangChain"], "live": "https://huggingface.co/spaces/sreelekhaputta2/GenDoc_AI", "video": "GendocAI.mp4", "thumb": "GendocAI_thumb.jpg"},
7
+ {"name": "LinkShield", "desc": "Advanced URL security threat detection", "skills": ["Cybersecurity", "API Integration", "FastAPI"], "live": "https://huggingface.co/spaces/sreelekhaputta2/LinkShield", "video": "Linkshield.mp4", "thumb": "Linkshield_thumb.jpg"},
8
+ {"name": "Chatbot", "desc": "Multi-modal conversational AI with memory", "skills": ["LLMs", "RAG", "Vector DB"], "live": "https://huggingface.co/spaces/sreelekhaputta2/Chatbot", "video": "Wiseverse.mp4", "thumb": "Wiseverse_thumb.jpg"},
9
+ {"name": "AvatarVerse", "desc": "Photorealistic AI avatar generator", "skills": ["Stable Diffusion", "ControlNet", "GANs"], "live": "https://huggingface.co/spaces/sreelekhaputta2/AvatarVerse", "video": "Avatarverse.mp4", "thumb": "Avatarverse_thumb.jpg"}
10
  ]
11
 
12
  css = """
 
14
 
15
  * { font-family: 'Inter', sans-serif !important; }
16
 
17
+ body { margin: 0 !important; padding: 0 !important; overflow-x: hidden !important; }
 
 
 
 
18
 
19
+ .gradio-container { background: none !important; position: relative !important; min-height: 100vh !important; }
 
 
 
 
20
 
21
  #background-video {
22
+ position: fixed !important; top: 0 !important; left: 0 !important;
23
+ width: 100vw !important; height: 100vh !important;
24
+ object-fit: cover !important; z-index: -2 !important; pointer-events: none !important;
 
 
 
 
 
25
  }
26
 
27
  .video-overlay {
28
+ position: fixed !important; top: 0 !important; left: 0 !important;
29
+ width: 100vw !important; height: 100vh !important;
 
 
 
30
  background: linear-gradient(rgba(15,15,35,0.85), rgba(45,27,105,0.85)) !important;
31
  z-index: -1 !important;
32
  }
 
40
  }
41
 
42
  .center-content {
43
+ display: flex !important; flex-direction: column !important;
44
+ align-items: center !important; text-align: center !important;
 
 
45
  justify-content: center !important;
46
  }
47
 
48
  .demo-btn {
49
  background: linear-gradient(135deg, #ff6b6b, #feca57) !important;
50
+ border: none !important; border-radius: 16px !important;
51
+ color: white !important; font-weight: 600 !important;
52
+ padding: 1.2rem 2.5rem !important; font-size: 1.1rem !important;
53
+ width: 100% !important; max-width: 350px !important;
54
+ margin: 1rem auto !important; transition: all 0.3s ease !important;
55
+ text-decoration: none !important; display: inline-block !important;
 
 
 
 
 
 
56
  text-align: center !important;
57
  }
58
 
 
61
  box-shadow: 0 20px 40px rgba(255, 107, 107, 0.4) !important;
62
  }
63
 
64
+ /* FAST VIDEO LOADING */
65
+ .fast-video-container {
66
+ position: relative !important; width: 100% !important; max-width: 650px !important;
67
+ height: 280px !important; margin: 1rem auto !important;
68
+ }
69
+
70
+ .fast-video-poster {
71
+ width: 100% !important; height: 280px !important;
72
+ object-fit: cover !important; border-radius: 16px !important;
73
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3) !important;
74
+ transition: opacity 0.3s ease !important;
75
+ }
76
+
77
+ .fast-video-player {
78
+ width: 100% !important; height: 280px !important;
79
+ border-radius: 16px !important; box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3) !important;
80
+ }
81
+
82
+ .fast-video-player video {
83
+ width: 100% !important; height: 280px !important;
84
+ object-fit: cover !important; border-radius: 16px !important;
85
  }
86
 
87
  .header-gradient {
88
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
89
+ border-radius: 24px !important; padding: 2.5rem !important;
90
+ text-align: center !important; box-shadow: 0 25px 50px rgba(102, 126, 234, 0.4) !important;
 
 
91
  }
92
 
93
  @media (max-width: 768px) {
94
  .demo-btn { padding: 1rem 2rem !important; font-size: 1rem !important; }
95
+ .fast-video-container, .fast-video-poster, .fast-video-player { height: 220px !important; }
96
  }
97
  """
98
 
99
+ def create_fast_video_html(video_file, thumb_file):
100
+ return f"""
101
+ <div class="fast-video-container">
102
+ <img src="{thumb_file}" class="fast-video-poster" alt="Demo thumbnail" loading="lazy">
103
+ <div class="fast-video-player">
104
+ <video preload="metadata" muted loop playsinline controlsList="nodownload" style="width:100%;height:100%;">
105
+ <source src="{video_file}" type="video/mp4">
106
+ <img src="{thumb_file}" style="width:100%;height:100%;object-fit:cover;">
107
+ </video>
108
+ </div>
109
+ </div>
110
+ """
111
+
112
  with gr.Blocks() as demo:
113
  # Background Video
114
  gr.HTML("""
115
+ <video autoplay muted loop playsinline id="background-video">
116
  <source src="bg.mp4" type="video/mp4">
117
  </video>
118
  <div class="video-overlay"></div>
 
122
  with gr.Row(variant="compact", elem_classes="center-content"):
123
  gr.HTML("""
124
  <div class="header-gradient glass-card">
125
+ <h1 style="margin: 0; font-weight: 800; font-size: 3rem;
126
+ background: linear-gradient(135deg, #ffffff 0%, #e0e7ff 100%);
127
+ -webkit-background-clip: text; -webkit-text-fill-color: transparent;
128
+ background-clip: text;">
129
  ✨ AI/ML Projects
130
  </h1>
131
  <p style="margin: 1rem 0 0 0; font-size: 1.3rem; opacity: 0.9;">
 
134
  </div>
135
  """)
136
 
137
+ # Project Tabs - FAST LOADING
138
  with gr.Tabs():
139
  for proj in projects:
140
  with gr.TabItem(proj["name"]):
 
144
  gr.Markdown(f"**🛠️ Tech Stack:** {' • '.join(proj['skills'])}")
145
 
146
  gr.HTML(f'''
147
+ <a href="{proj["live"]}" target="_blank" class="demo-btn">
148
  🎮 Launch {proj['name']} Live Demo
149
  </a>
150
  ''')
151
 
152
+ # ULTRA-FAST VIDEO with thumbnail
153
+ gr.HTML(create_fast_video_html(proj["video"], proj["thumb"]))
 
 
 
 
 
154
 
155
  demo.launch(
156
  share=True,