Spaces:
Runtime error
Runtime error
Update app.py
Browse files1 unmodified line234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592601 unmodified lineimport webbrowserdef open_hairpick():"""Open HairPick website in a new tab"""webbrowser.open("https://hairpick.me")return "β HairPick opened in a new tab! Check your browser."def create_interface():"""Create Gradio interface for HairPick launcher"""with gr.Blocks(title="HairPick - AI Hair Style Simulator",theme=gr.themes.Soft(primary_hue="purple",secondary_hue="pink"),css=""".gradio-container {font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;max-width: 1200px;margin: 0 auto;}#header {background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);padding: 40px;border-radius: 20px;text-align: center;color: white;margin-bottom: 30px;box-shadow: 0 10px 40px rgba(118, 75, 162, 0.3);}#header h1 {margin: 0 0 15px 0;font-size: 3em;font-weight: 700;}#header p {font-size: 1.3em;opacity: 0.95;line-height: 1.6;}.feature-box {background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);padding: 30px;border-radius: 15px;margin: 20px 0;}.stat-grid {display: grid;grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));gap: 20px;margin: 30px 0;}.stat-card {background: white;padding: 25px;border-radius: 15px;text-align: center;box-shadow: 0 5px 20px rgba(0,0,0,0.1);transition: transform 0.3s ease;}.stat-card:hover {transform: translateY(-5px);}.stat-number {font-size: 2.5em;font-weight: bold;color: #764ba2;margin-bottom: 10px;}.cta-section {background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);padding: 40px;border-radius: 20px;text-align: center;color: white;margin: 40px 0;box-shadow: 0 10px 40px rgba(255, 107, 107, 0.3);}""") as demo:# Headergr.HTML("""<div id="header"><h1>β¨ HairPick AI Hair Simulator β¨</h1><p>Preview Your Perfect Hairstyle in 360Β° Before Cutting!</p><p style="margin-top: 20px; font-size: 1.1em;">π FREE Trial - Limited Time Offer! π</p></div>""")# Main contentwith gr.Row():with gr.Column():gr.Markdown("""## π Welcome to HairPick!Experience the future of hairstyling with our revolutionary AI-powered 360Β° hair simulator.No more haircut regrets - see exactly how you'll look from every angle before making the cut!""")# Launch buttonwith gr.Row():with gr.Column(scale=1):launch_btn = gr.Button("π¨ Launch HairPick Now!",variant="primary",size="lg",elem_id="launch-btn")with gr.Column(scale=1):gr.HTML("""<div style="text-align: center; padding: 10px;"><a href="https://hairpick.me" target="_blank"style="background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);color: white; padding: 20px 40px; font-size: 1.2em;border-radius: 50px; text-decoration: none;display: inline-block; font-weight: bold;box-shadow: 0 10px 30px rgba(255,107,107,0.4);transition: all 0.3s ease;"onmouseover="this.style.transform='translateY(-3px) scale(1.05)'"onmouseout="this.style.transform='translateY(0) scale(1)'">π Open in Browser β</a></div>""")status_msg = gr.Textbox(label="Status",interactive=False,visible=False)launch_btn.click(fn=open_hairpick, outputs=status_msg)# Stats sectiongr.HTML("""<div class="stat-grid"><div class="stat-card"><div class="stat-number">360Β°</div><div>Full View Coverage</div></div><div class="stat-card"><div class="stat-number">100+</div><div>Hairstyle Options</div></div><div class="stat-card"><div class="stat-number">5</div><div>Angle Perspectives</div></div><div class="stat-card"><div class="stat-number">30s</div><div>Quick Results</div></div></div>""")# Featureswith gr.Row():with gr.Column():gr.Markdown("""### π Why HairPick is DifferentUnlike other apps that only show the front view, HairPick provides:- **360Β° Complete Preview** - See front, sides, diagonal, and back views- **100+ Trendy Styles** - From short pixie cuts to long flowing locks- **AI-Powered Accuracy** - Advanced algorithms for realistic results- **Instant Results** - Get your preview in just 30 seconds- **Save & Share** - Download images to show your stylist""")with gr.Column():gr.Markdown("""### πΈ How to Use1. **Upload Your Photo** - Clear front-facing selfie2. **Choose a Style** - Browse our extensive library3. **View 360Β° Results** - Check all angles4. **Save & Share** - Take it to your salon!**Pro Tips:**- Use bright, even lighting- Pull hair back to show face shape- Keep a neutral expression""")# Call to actiongr.HTML("""<div class="cta-section"><h2 style="margin-bottom: 20px;">π Special Offer - Free Access!</h2><p style="font-size: 1.2em; margin-bottom: 30px;">Join thousands of users who've found their perfect hairstyle with HairPick!</p><a href="https://hairpick.me" target="_blank"style="background: white; color: #FF6B6B; padding: 20px 50px;font-size: 1.3em; border-radius: 50px; text-decoration: none;display: inline-block; font-weight: bold; transition: all 0.3s;"onmouseover="this.style.transform='scale(1.1)'"onmouseout="this.style.transform='scale(1)'">Start Your Hair Transformation β</a></div>""")# Testimonialsgr.Markdown("""---### π¬ What Users Are Saying> "Finally, I can see how I'll look from behind! No more surprises!" - **Sarah M.**> "Showed my stylist the 360Β° view, got exactly what I wanted!" - **David L.**> "Tried 20 different styles before choosing. Best decision ever!" - **Emma K.**""")# Footergr.HTML("""<div style="text-align: center; padding: 40px 0; border-top: 2px solid #e0e0e0; margin-top: 50px;"><p style="color: #666; font-size: 1.1em; margin-bottom: 20px;"><strong>HairPick</strong> - AI-Powered 360Β° Hair Style Simulator</p><p><a href="https://hairpick.me" target="_blank"style="color: #764ba2; text-decoration: none; font-weight: bold; font-size: 1.2em;">www.hairpick.me</a></p><p style="margin-top: 20px; color: #888;">#HairPick #AIHairSimulator #360HairPreview #VirtualHairTryOn #HairTransformation</p></div>""")return demoif __name__ == "__main__":# Create and launch the interfacedemo = create_interface()print("\n" + "="*60)print("π HairPick Launcher Application")print("="*60)print("π Starting Gradio server...")print("π App will open in your browser automatically")print("π Manual access: http://127.0.0.1:7860")print("π HairPick URL: https://hairpick.me")print("π‘ Press CTRL+C to stop the server")print("="*60 + "\n")# Launch the appdemo.launch(server_name="127.0.0.1",server_port=7860,share=False, # Set to True for public URLinbrowser=True, # Auto open browsershow_error=True)1 unmodified line2345678910111213141516171819202122232425262728293031323334353637383940414243441 unmodified lineimport webbrowserdef open_hairpick():"""Open HairPick website"""webbrowser.open("https://hairpick.me")return "β HairPick opened in new tab!"with gr.Blocks(title="HairPick") as demo:gr.Markdown("""# π¨ HairPick - AI Hair Style Simulator### Preview your perfect hairstyle in 360Β° before cutting!**β¨ Features:**- 360Β° view (front, side, back)- 100+ hairstyles- Free trial availableClick below to start:""")with gr.Row():btn = gr.Button("π Open HairPick", variant="primary", size="lg")status = gr.Textbox(label="Status", visible=False)btn.click(open_hairpick, outputs=status)gr.HTML("""<br><center><a href="https://hairpick.me" target="_blank"style="font-size: 20px; color: purple;">π www.hairpick.me</a></center>""")if __name__ == "__main__":demo.launch(inbrowser=True)
app.py+30-246