Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,259 +2,43 @@ import gradio as gr
|
|
| 2 |
import webbrowser
|
| 3 |
|
| 4 |
def open_hairpick():
|
| 5 |
-
"""Open HairPick website
|
| 6 |
webbrowser.open("https://hairpick.me")
|
| 7 |
-
return "✅ HairPick opened in
|
| 8 |
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
with gr.Blocks(
|
| 13 |
-
title="HairPick - AI Hair Style Simulator",
|
| 14 |
-
theme=gr.themes.Soft(
|
| 15 |
-
primary_hue="purple",
|
| 16 |
-
secondary_hue="pink"
|
| 17 |
-
),
|
| 18 |
-
css="""
|
| 19 |
-
.gradio-container {
|
| 20 |
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
| 21 |
-
max-width: 1200px;
|
| 22 |
-
margin: 0 auto;
|
| 23 |
-
}
|
| 24 |
-
#header {
|
| 25 |
-
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 26 |
-
padding: 40px;
|
| 27 |
-
border-radius: 20px;
|
| 28 |
-
text-align: center;
|
| 29 |
-
color: white;
|
| 30 |
-
margin-bottom: 30px;
|
| 31 |
-
box-shadow: 0 10px 40px rgba(118, 75, 162, 0.3);
|
| 32 |
-
}
|
| 33 |
-
#header h1 {
|
| 34 |
-
margin: 0 0 15px 0;
|
| 35 |
-
font-size: 3em;
|
| 36 |
-
font-weight: 700;
|
| 37 |
-
}
|
| 38 |
-
#header p {
|
| 39 |
-
font-size: 1.3em;
|
| 40 |
-
opacity: 0.95;
|
| 41 |
-
line-height: 1.6;
|
| 42 |
-
}
|
| 43 |
-
.feature-box {
|
| 44 |
-
background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
|
| 45 |
-
padding: 30px;
|
| 46 |
-
border-radius: 15px;
|
| 47 |
-
margin: 20px 0;
|
| 48 |
-
}
|
| 49 |
-
.stat-grid {
|
| 50 |
-
display: grid;
|
| 51 |
-
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
| 52 |
-
gap: 20px;
|
| 53 |
-
margin: 30px 0;
|
| 54 |
-
}
|
| 55 |
-
.stat-card {
|
| 56 |
-
background: white;
|
| 57 |
-
padding: 25px;
|
| 58 |
-
border-radius: 15px;
|
| 59 |
-
text-align: center;
|
| 60 |
-
box-shadow: 0 5px 20px rgba(0,0,0,0.1);
|
| 61 |
-
transition: transform 0.3s ease;
|
| 62 |
-
}
|
| 63 |
-
.stat-card:hover {
|
| 64 |
-
transform: translateY(-5px);
|
| 65 |
-
}
|
| 66 |
-
.stat-number {
|
| 67 |
-
font-size: 2.5em;
|
| 68 |
-
font-weight: bold;
|
| 69 |
-
color: #764ba2;
|
| 70 |
-
margin-bottom: 10px;
|
| 71 |
-
}
|
| 72 |
-
.cta-section {
|
| 73 |
-
background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
|
| 74 |
-
padding: 40px;
|
| 75 |
-
border-radius: 20px;
|
| 76 |
-
text-align: center;
|
| 77 |
-
color: white;
|
| 78 |
-
margin: 40px 0;
|
| 79 |
-
box-shadow: 0 10px 40px rgba(255, 107, 107, 0.3);
|
| 80 |
-
}
|
| 81 |
"""
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
# Header
|
| 85 |
-
gr.HTML("""
|
| 86 |
-
<div id="header">
|
| 87 |
-
<h1>✨ HairPick AI Hair Simulator ✨</h1>
|
| 88 |
-
<p>Preview Your Perfect Hairstyle in 360° Before Cutting!</p>
|
| 89 |
-
<p style="margin-top: 20px; font-size: 1.1em;">🎊 FREE Trial - Limited Time Offer! 🎊</p>
|
| 90 |
-
</div>
|
| 91 |
-
""")
|
| 92 |
-
|
| 93 |
-
# Main content
|
| 94 |
-
with gr.Row():
|
| 95 |
-
with gr.Column():
|
| 96 |
-
gr.Markdown("""
|
| 97 |
-
## 🚀 Welcome to HairPick!
|
| 98 |
-
|
| 99 |
-
Experience the future of hairstyling with our revolutionary AI-powered 360° hair simulator.
|
| 100 |
-
No more haircut regrets - see exactly how you'll look from every angle before making the cut!
|
| 101 |
-
""")
|
| 102 |
-
|
| 103 |
-
# Launch button
|
| 104 |
-
with gr.Row():
|
| 105 |
-
with gr.Column(scale=1):
|
| 106 |
-
launch_btn = gr.Button(
|
| 107 |
-
"🎨 Launch HairPick Now!",
|
| 108 |
-
variant="primary",
|
| 109 |
-
size="lg",
|
| 110 |
-
elem_id="launch-btn"
|
| 111 |
-
)
|
| 112 |
-
with gr.Column(scale=1):
|
| 113 |
-
gr.HTML("""
|
| 114 |
-
<div style="text-align: center; padding: 10px;">
|
| 115 |
-
<a href="https://hairpick.me" target="_blank"
|
| 116 |
-
style="background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
|
| 117 |
-
color: white; padding: 20px 40px; font-size: 1.2em;
|
| 118 |
-
border-radius: 50px; text-decoration: none;
|
| 119 |
-
display: inline-block; font-weight: bold;
|
| 120 |
-
box-shadow: 0 10px 30px rgba(255,107,107,0.4);
|
| 121 |
-
transition: all 0.3s ease;"
|
| 122 |
-
onmouseover="this.style.transform='translateY(-3px) scale(1.05)'"
|
| 123 |
-
onmouseout="this.style.transform='translateY(0) scale(1)'">
|
| 124 |
-
🌐 Open in Browser →
|
| 125 |
-
</a>
|
| 126 |
-
</div>
|
| 127 |
-
""")
|
| 128 |
-
|
| 129 |
-
status_msg = gr.Textbox(
|
| 130 |
-
label="Status",
|
| 131 |
-
interactive=False,
|
| 132 |
-
visible=False
|
| 133 |
-
)
|
| 134 |
-
|
| 135 |
-
launch_btn.click(fn=open_hairpick, outputs=status_msg)
|
| 136 |
|
| 137 |
-
|
| 138 |
-
gr.HTML("""
|
| 139 |
-
<div class="stat-grid">
|
| 140 |
-
<div class="stat-card">
|
| 141 |
-
<div class="stat-number">360°</div>
|
| 142 |
-
<div>Full View Coverage</div>
|
| 143 |
-
</div>
|
| 144 |
-
<div class="stat-card">
|
| 145 |
-
<div class="stat-number">100+</div>
|
| 146 |
-
<div>Hairstyle Options</div>
|
| 147 |
-
</div>
|
| 148 |
-
<div class="stat-card">
|
| 149 |
-
<div class="stat-number">5</div>
|
| 150 |
-
<div>Angle Perspectives</div>
|
| 151 |
-
</div>
|
| 152 |
-
<div class="stat-card">
|
| 153 |
-
<div class="stat-number">30s</div>
|
| 154 |
-
<div>Quick Results</div>
|
| 155 |
-
</div>
|
| 156 |
-
</div>
|
| 157 |
-
""")
|
| 158 |
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
### 🔄 Why HairPick is Different
|
| 164 |
-
|
| 165 |
-
Unlike other apps that only show the front view, HairPick provides:
|
| 166 |
-
|
| 167 |
-
- **360° Complete Preview** - See front, sides, diagonal, and back views
|
| 168 |
-
- **100+ Trendy Styles** - From short pixie cuts to long flowing locks
|
| 169 |
-
- **AI-Powered Accuracy** - Advanced algorithms for realistic results
|
| 170 |
-
- **Instant Results** - Get your preview in just 30 seconds
|
| 171 |
-
- **Save & Share** - Download images to show your stylist
|
| 172 |
-
""")
|
| 173 |
-
|
| 174 |
-
with gr.Column():
|
| 175 |
-
gr.Markdown("""
|
| 176 |
-
### 📸 How to Use
|
| 177 |
-
|
| 178 |
-
1. **Upload Your Photo** - Clear front-facing selfie
|
| 179 |
-
2. **Choose a Style** - Browse our extensive library
|
| 180 |
-
3. **View 360° Results** - Check all angles
|
| 181 |
-
4. **Save & Share** - Take it to your salon!
|
| 182 |
-
|
| 183 |
-
**Pro Tips:**
|
| 184 |
-
- Use bright, even lighting
|
| 185 |
-
- Pull hair back to show face shape
|
| 186 |
-
- Keep a neutral expression
|
| 187 |
-
""")
|
| 188 |
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 196 |
<a href="https://hairpick.me" target="_blank"
|
| 197 |
-
style="
|
| 198 |
-
|
| 199 |
-
display: inline-block; font-weight: bold; transition: all 0.3s;"
|
| 200 |
-
onmouseover="this.style.transform='scale(1.1)'"
|
| 201 |
-
onmouseout="this.style.transform='scale(1)'">
|
| 202 |
-
Start Your Hair Transformation →
|
| 203 |
</a>
|
| 204 |
-
</
|
| 205 |
-
"""
|
| 206 |
-
|
| 207 |
-
# Testimonials
|
| 208 |
-
gr.Markdown("""
|
| 209 |
-
---
|
| 210 |
-
### 💬 What Users Are Saying
|
| 211 |
-
|
| 212 |
-
> "Finally, I can see how I'll look from behind! No more surprises!" - **Sarah M.**
|
| 213 |
-
|
| 214 |
-
> "Showed my stylist the 360° view, got exactly what I wanted!" - **David L.**
|
| 215 |
-
|
| 216 |
-
> "Tried 20 different styles before choosing. Best decision ever!" - **Emma K.**
|
| 217 |
-
""")
|
| 218 |
-
|
| 219 |
-
# Footer
|
| 220 |
-
gr.HTML("""
|
| 221 |
-
<div style="text-align: center; padding: 40px 0; border-top: 2px solid #e0e0e0; margin-top: 50px;">
|
| 222 |
-
<p style="color: #666; font-size: 1.1em; margin-bottom: 20px;">
|
| 223 |
-
<strong>HairPick</strong> - AI-Powered 360° Hair Style Simulator
|
| 224 |
-
</p>
|
| 225 |
-
<p>
|
| 226 |
-
<a href="https://hairpick.me" target="_blank"
|
| 227 |
-
style="color: #764ba2; text-decoration: none; font-weight: bold; font-size: 1.2em;">
|
| 228 |
-
www.hairpick.me
|
| 229 |
-
</a>
|
| 230 |
-
</p>
|
| 231 |
-
<p style="margin-top: 20px; color: #888;">
|
| 232 |
-
#HairPick #AIHairSimulator #360HairPreview #VirtualHairTryOn #HairTransformation
|
| 233 |
-
</p>
|
| 234 |
-
</div>
|
| 235 |
-
""")
|
| 236 |
-
|
| 237 |
-
return demo
|
| 238 |
|
| 239 |
if __name__ == "__main__":
|
| 240 |
-
|
| 241 |
-
demo = create_interface()
|
| 242 |
-
|
| 243 |
-
print("\n" + "="*60)
|
| 244 |
-
print("🚀 HairPick Launcher Application")
|
| 245 |
-
print("="*60)
|
| 246 |
-
print("📍 Starting Gradio server...")
|
| 247 |
-
print("📍 App will open in your browser automatically")
|
| 248 |
-
print("📍 Manual access: http://127.0.0.1:7860")
|
| 249 |
-
print("🌐 HairPick URL: https://hairpick.me")
|
| 250 |
-
print("💡 Press CTRL+C to stop the server")
|
| 251 |
-
print("="*60 + "\n")
|
| 252 |
-
|
| 253 |
-
# Launch the app
|
| 254 |
-
demo.launch(
|
| 255 |
-
server_name="127.0.0.1",
|
| 256 |
-
server_port=7860,
|
| 257 |
-
share=False, # Set to True for public URL
|
| 258 |
-
inbrowser=True, # Auto open browser
|
| 259 |
-
show_error=True
|
| 260 |
-
)
|
|
|
|
| 2 |
import webbrowser
|
| 3 |
|
| 4 |
def open_hairpick():
|
| 5 |
+
"""Open HairPick website"""
|
| 6 |
webbrowser.open("https://hairpick.me")
|
| 7 |
+
return "✅ HairPick opened in new tab!"
|
| 8 |
|
| 9 |
+
with gr.Blocks(title="HairPick") as demo:
|
| 10 |
+
gr.Markdown(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
"""
|
| 12 |
+
# 🎨 HairPick - AI Hair Style Simulator
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
+
### Preview your perfect hairstyle in 360° before cutting!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
+
**✨ Features:**
|
| 17 |
+
- 360° view (front, side, back)
|
| 18 |
+
- 100+ hairstyles
|
| 19 |
+
- Free trial available
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
+
Click below to start:
|
| 22 |
+
"""
|
| 23 |
+
)
|
| 24 |
+
|
| 25 |
+
with gr.Row():
|
| 26 |
+
btn = gr.Button("🚀 Open HairPick", variant="primary", size="lg")
|
| 27 |
+
status = gr.Textbox(label="Status", visible=False)
|
| 28 |
+
|
| 29 |
+
btn.click(open_hairpick, outputs=status)
|
| 30 |
+
|
| 31 |
+
gr.HTML(
|
| 32 |
+
"""
|
| 33 |
+
<br>
|
| 34 |
+
<center>
|
| 35 |
<a href="https://hairpick.me" target="_blank"
|
| 36 |
+
style="font-size: 20px; color: purple;">
|
| 37 |
+
🌐 www.hairpick.me
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
</a>
|
| 39 |
+
</center>
|
| 40 |
+
"""
|
| 41 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
if __name__ == "__main__":
|
| 44 |
+
demo.launch(inbrowser=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|