sreelekhaputta2 commited on
Commit
a51484e
·
verified ·
1 Parent(s): ff030c0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +163 -67
app.py CHANGED
@@ -1,87 +1,183 @@
 
 
1
  import gradio as gr
2
- import os
3
 
4
- # --- 1. DATA ---
5
  projects = [
6
- {"name": "Idealyze", "desc": "AI-powered content optimization", "live": "https://huggingface.co/spaces/sreelekhaputta2/Idealyze", "video": "Idealyze.mp4"},
7
- {"name": "DivineLoop", "desc": "Audio-visual looping generator", "live": "https://huggingface.co/spaces/sreelekhaputta2/DivineLoop", "video": "Divineloop.mp4"},
8
- {"name": "GenDoc_AI", "desc": "Intelligent PDF generation", "live": "https://huggingface.co/spaces/sreelekhaputta2/GenDoc_AI", "video": "GendocAI.mp4"},
9
- {"name": "LinkShield", "desc": "URL security detection", "live": "https://huggingface.co/spaces/sreelekhaputta2/LinkShield", "video": "Linkshield.mp4"},
10
- {"name": "Chatbot", "desc": "Multi-modal AI with memory", "live": "https://huggingface.co/spaces/sreelekhaputta2/Chatbot", "video": "Wiseverse.mp4"},
11
- {"name": "AvatarVerse", "desc": "Photorealistic AI avatars", "live": "https://huggingface.co/spaces/sreelekhaputta2/AvatarVerse", "video": "Avatarverse.mp4"}
12
  ]
13
 
14
- # --- 2. THE NUCLEAR CSS OPTION ---
15
- # This forces EVERYTHING in Gradio to be transparent
16
  css = """
17
- body, .gradio-container, .main, #root, .flex-col, .tabs, .tabitem, footer {
18
- background-color: transparent !important;
19
- background: transparent !important;
20
- border: none !important;
 
21
  }
22
 
23
- #bg-container {
24
- position: fixed;
25
- top: 0;
26
- left: 0;
27
- width: 100vw;
28
- height: 100vh;
29
- z-index: -100;
 
30
  }
31
 
32
- video#bg-video {
33
- width: 100%;
34
- height: 100%;
35
- object-fit: cover;
 
 
 
 
36
  }
37
 
38
- .overlay {
39
- position: fixed;
40
- top: 0;
41
- left: 0;
42
- width: 100%;
43
- height: 100%;
44
- background: rgba(0, 0, 0, 0.65); /* Darken for readability */
45
- z-index: -90;
46
  }
47
 
48
- .glass-card {
49
- background: rgba(255, 255, 255, 0.1) !important;
50
- backdrop-filter: blur(15px);
51
- border: 1px solid rgba(255, 255, 255, 0.2);
52
- border-radius: 20px;
53
- padding: 20px;
54
- color: white !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  }
56
  """
57
 
58
- # --- 3. INTERFACE ---
59
- with gr.Blocks(css=css, theme=gr.themes.Default()) as demo:
 
 
 
60
 
61
- # Using the standard /file= syntax which is faster than Base64
62
- gr.HTML("""
63
- <div id="bg-container">
64
- <video autoplay muted loop playsinline id="bg-video">
65
- <source src="file/bg.mp4" type="video/mp4">
66
- </video>
67
- <div class="overlay"></div>
68
- </div>
69
- """)
70
-
71
- with gr.Column():
72
- gr.Markdown("# ✨ AI/ML Portfolio", elem_classes="glass-card")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
 
74
- with gr.Tabs():
75
- for proj in projects:
76
- with gr.TabItem(proj["name"]):
77
- with gr.Column(elem_classes="glass-card"):
78
- gr.Markdown(f"## {proj['name']}")
79
- gr.Markdown(proj['desc'])
80
- gr.HTML(f'<a href="{proj["live"]}" target="_blank" style="color: cyan;">🎮 Live Demo</a>')
81
-
82
- if os.path.exists(proj["video"]):
83
- gr.Video(value=proj["video"], height=300)
 
 
 
 
 
 
 
 
 
 
 
84
 
85
- # --- 4. LAUNCH ---
86
- # allowed_paths is KEY. It tells Gradio it's allowed to serve these files.
87
- demo.launch(allowed_paths=["."])
 
1
+ !pip install gradio==5.4.1 -q
2
+
3
  import gradio as gr
 
4
 
 
5
  projects = [
6
+ {"name": "Idealyze", "desc": "AI-powered content optimization platform", "skills": ["NLP", "Transformers", "FastAPI"], "live": "https://huggingface.co/spaces/sreelekhaputta2/Idealyze", "video": "Idealyze.mp4"},
7
+ {"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"},
8
+ {"name": "GenDoc_AI", "desc": "Intelligent PDF document generation", "skills": ["LLMs", "PDF Generation", "LangChain"], "live": "https://huggingface.co/spaces/sreelekhaputta2/GenDoc_AI", "video": "GendocAI.mp4"},
9
+ {"name": "LinkShield", "desc": "Advanced URL security threat detection", "skills": ["Cybersecurity", "API Integration", "FastAPI"], "live": "https://huggingface.co/spaces/sreelekhaputta2/LinkShield", "video": "Linkshield.mp4"},
10
+ {"name": "Chatbot", "desc": "Multi-modal conversational AI with memory", "skills": ["LLMs", "RAG", "Vector DB"], "live": "https://huggingface.co/spaces/sreelekhaputta2/Chatbot", "video": "Wiseverse.mp4"},
11
+ {"name": "AvatarVerse", "desc": "Photorealistic AI avatar generator", "skills": ["Stable Diffusion", "ControlNet", "GANs"], "live": "https://huggingface.co/spaces/sreelekhaputta2/AvatarVerse", "video": "Avatarverse.mp4"}
12
  ]
13
 
 
 
14
  css = """
15
+ @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');
16
+ * { font-family: 'Inter', sans-serif !important; }
17
+ body {
18
+ margin: 0 !important; padding: 0 !important; overflow-x: hidden !important;
19
+ background: #0a0a1a !important;
20
  }
21
 
22
+ #particles-canvas {
23
+ position: fixed !important;
24
+ top: 0 !important;
25
+ left: 0 !important;
26
+ width: 100vw !important;
27
+ height: 100vh !important;
28
+ z-index: -1 !important;
29
+ pointer-events: none !important;
30
  }
31
 
32
+ .pexels-overlay {
33
+ position: fixed !important;
34
+ top: 0 !important;
35
+ left: 0 !important;
36
+ width: 100vw !important;
37
+ height: 100vh !important;
38
+ background: linear-gradient(rgba(10,10,26,0.7), rgba(45,27,105,0.6)) !important;
39
+ z-index: 0 !important;
40
  }
41
 
42
+ .glass-card {
43
+ background: rgba(255, 255, 255, 0.15) !important;
44
+ backdrop-filter: blur(25px) !important;
45
+ border: 1px solid rgba(255, 255, 255, 0.2) !important;
46
+ border-radius: 24px !important;
47
+ box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4) !important;
 
 
48
  }
49
 
50
+ .center-content {
51
+ display: flex !important; flex-direction: column !important;
52
+ align-items: center !important; text-align: center !important;
53
+ justify-content: center !important;
54
+ }
55
+
56
+ .demo-btn {
57
+ background: linear-gradient(135deg, #ff6b6b, #feca57) !important;
58
+ border: none !important; border-radius: 16px !important;
59
+ color: white !important; font-weight: 600 !important;
60
+ padding: 1.2rem 2.5rem !important; font-size: 1.1rem !important;
61
+ width: 100% !important; max-width: 350px !important;
62
+ margin: 1rem auto !important; transition: all 0.3s ease !important;
63
+ text-decoration: none !important; display: inline-block !important;
64
+ }
65
+
66
+ .demo-btn:hover {
67
+ transform: scale(1.05) !important;
68
+ box-shadow: 0 20px 40px rgba(255, 107, 107, 0.4) !important;
69
+ }
70
+
71
+ .video-medium {
72
+ height: 350px !important; max-width: 100% !important; width: 650px !important;
73
+ border-radius: 16px !important; box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3) !important;
74
+ }
75
+
76
+ .header-gradient {
77
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
78
+ border-radius: 24px !important; padding: 3rem !important;
79
+ text-align: center !important; box-shadow: 0 25px 50px rgba(102, 126, 234, 0.4) !important;
80
+ margin: 2rem auto !important; max-width: 800px !important;
81
  }
82
  """
83
 
84
+ with gr.Blocks(css=css, theme=gr.themes.Soft()) as demo:
85
+ # PEXELS-STYLE PARTICLE VIDEO BACKGROUND
86
+ gr.HTML('''
87
+ <canvas id="particles-canvas"></canvas>
88
+ <div class="pexels-overlay"></div>
89
 
90
+ <script>
91
+ const canvas = document.getElementById('particles-canvas');
92
+ const ctx = canvas.getContext('2d');
93
+
94
+ canvas.width = window.innerWidth;
95
+ canvas.height = window.innerHeight;
96
+
97
+ window.addEventListener('resize', () => {
98
+ canvas.width = window.innerWidth;
99
+ canvas.height = window.innerHeight;
100
+ });
101
+
102
+ const particles = [];
103
+ const particleCount = 120;
104
+
105
+ class Particle {
106
+ constructor() {
107
+ this.x = Math.random() * canvas.width;
108
+ this.y = Math.random() * canvas.height;
109
+ this.size = Math.random() * 3 + 1;
110
+ this.speedX = Math.random() * 0.5 - 0.25;
111
+ this.speedY = Math.random() * 0.5 - 0.25;
112
+ this.hue = Math.random() * 60 + 200; // Cyan-blue spectrum
113
+ }
114
+
115
+ update() {
116
+ this.x += this.speedX;
117
+ this.y += this.speedY;
118
+
119
+ if (this.x > canvas.width || this.x < 0) this.speedX *= -1;
120
+ if (this.y > canvas.height || this.y < 0) this.speedY *= -1;
121
+ }
122
+
123
+ draw() {
124
+ ctx.save();
125
+ ctx.globalAlpha = 0.7;
126
+ ctx.fillStyle = `hsl(${this.hue}, 70%, 60%)`;
127
+ ctx.shadowBlur = 10;
128
+ ctx.shadowColor = `hsl(${this.hue}, 70%, 50%)`;
129
+ ctx.beginPath();
130
+ ctx.arc(this.x, this.y, this.size, 0, Math.PI * 2);
131
+ ctx.fill();
132
+ ctx.restore();
133
+ }
134
+ }
135
+
136
+ for (let i = 0; i < particleCount; i++) {
137
+ particles.push(new Particle());
138
+ }
139
+
140
+ function animate() {
141
+ ctx.fillStyle = 'rgba(10, 10, 26, 0.1)';
142
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
143
+
144
+ particles.forEach(p => {
145
+ p.update();
146
+ p.draw();
147
+ });
148
+
149
+ requestAnimationFrame(animate);
150
+ }
151
+
152
+ animate();
153
+ </script>
154
+ ''')
155
+
156
+ gr.Markdown(
157
+ "# ✨ **AI/ML Projects**\n\n**6 Production-Ready Projects • Live on Hugging Face**",
158
+ elem_classes="header-gradient glass-card center-content"
159
+ )
160
 
161
+ with gr.Tabs():
162
+ for proj in projects:
163
+ with gr.TabItem(proj["name"]):
164
+ with gr.Column(elem_classes="glass-card center-content"):
165
+ gr.Markdown(f"# 🚀 **{proj['name']}**")
166
+ gr.Markdown(f"**📝 {proj['desc']}**")
167
+ gr.Markdown(f"**🛠️ Tech Stack:** {' '.join(proj['skills'])}")
168
+
169
+ gr.HTML(f'''
170
+ <a href="{proj["live"]}" target="_blank" class="demo-btn">
171
+ 🎮 Launch {proj['name']} Live Demo
172
+ </a>
173
+ ''')
174
+
175
+ gr.Video(
176
+ value=proj["video"],
177
+ label="📹 Project Demo",
178
+ height=350,
179
+ interactive=False,
180
+ elem_classes="video-medium"
181
+ )
182
 
183
+ demo.launch(share=True, debug=True, height=950, show_error=True)