ProHeadshots / app.py
Beepeen24's picture
Update app.py
a170066 verified
raw
history blame
3.14 kB
import os
print("🚀 Starting AI Headshot Generator...")
import gradio as gr
import numpy as np
# Simple license system
ADMIN_KEYS = {"HEADSHOT-TEST123456", "HEADSHOT-OWNERACCESS"}
MAX_TRIALS = 3
def verify_license(key):
if not key:
return False
return key.strip().upper() in ADMIN_KEYS
def generate_headshot(image, license_key):
"""Simple demo function"""
# Check license
if not verify_license(license_key):
return np.zeros((512, 512, 3), dtype=np.uint8), "❌ Invalid license. Use: HEADSHOT-TEST123456"
# Create placeholder image
if image is not None:
h, w = image.shape[:2]
result = np.ones((h, w, 3), dtype=np.uint8) * 240
else:
result = np.ones((512, 512, 3), dtype=np.uint8) * 240
# Add simple text (no PIL to avoid extra dependencies)
# Just return the placeholder
return result, "✅ Generated successfully! Test key worked."
# Build interface
with gr.Blocks(title="AI Headshot Generator") as demo:
gr.Markdown("""
# 🎯 AI Headshot Generator
*Transform selfies into professional headshots*
""")
with gr.Row():
with gr.Column():
gr.Markdown("### 📸 Upload Your Photo")
image_input = gr.Image(
label="",
type="numpy",
height=250
)
gr.Markdown("### 🔑 License Key")
license_input = gr.Textbox(
label="",
value="HEADSHOT-TEST123456",
placeholder="Enter HEADSHOT-TEST123456"
)
gr.Markdown(f"""
### 🎯 How It Works
1. Upload a photo
2. Use test key: **HEADSHOT-TEST123456**
3. Get {MAX_TRIALS} free generations
4. Purchase license for HD downloads
[🔗 Purchase License](https://canadianheadshotpro.carrd.co)
""")
generate_btn = gr.Button(
"✨ Generate Headshot",
variant="primary",
size="lg"
)
status_output = gr.Textbox(
label="Status",
interactive=False
)
with gr.Column():
gr.Markdown("### 🖼️ Your Headshot")
result_image = gr.Image(
label="",
height=400
)
gr.Markdown("""
### 📥 Download Options
- **Free Trial**: Basic preview
- **Premium**: HD quality
- **Professional**: Multiple styles
⏱️ *AI models loading in next update*
""")
# Connect button
generate_btn.click(
generate_headshot,
[image_input, license_input],
[result_image, status_output]
)
# Footer
gr.Markdown("---")
gr.Markdown("""
<div style="text-align: center; color: #666;">
<p>Powered by AI | © 2024 Headshot Generator</p>
</div>
""")
if __name__ == "__main__":
demo.launch()