import gradio as gr import os import random from datetime import datetime from huggingface_hub import HfApi API = HfApi() ASSETS_REPO = "RedSparkie/dreamfactory-assets" SPACE_REPO = "RedSparkie/dreamfactory" NICHE_CATALOG = { "Cyberpunk": "cyberpunk, neon, futuristic, dystopian, sci-fi, night city, rain, holograms, synthwave", "Fantasy": "fantasy landscape, magical forest, dragons, enchanted, ethereal, mystical, medieval", "Minimalist Zen": "minimalist, zen, Japanese garden, nature, peaceful, serene, simple, elegant", "Steampunk": "steampunk, brass gears, mechanical, Victorian, retro-futuristic, clockwork, copper", "Cosmic/Abstract": "cosmic, abstract, galaxy, nebula, spiritual, surreal, universe, stars, ethereal", "Kawaii/Merch": "kawaii, cute, chibi, adorable, colorful, cartoon, merchandise-ready, print design", "Automotive/Luxury": "luxury car, sports car, automotive, chrome, speed, premium, showroom, photorealistic", } def generate_marketplace_metadata(meta): niche = meta.get("niche", "Art") tags = meta.get("tags", []) titles = { "Cyberpunk": f"Neon {random.choice(['Dragon','Cityscape','Warrior','Dream'])} – Premium Digital Art", "Fantasy": f"Enchanted {random.choice(['Forest','Realm','Waterfall','Garden'])} – Fantasy Art Print", "Minimalist Zen": f"Zen {random.choice(['Harmony','Balance','Serenity','Moment'])} – Minimalist Art", "Steampunk": f"Clockwork {random.choice(['Owl','Heart','City','Explorer'])} – Steampunk Digital", "Cosmic/Abstract": f"Cosmic {random.choice(['Awakening','Journey','Soul','Vision'])} – Abstract Art", "Kawaii/Merch": f"Cute {random.choice(['Space Cat','Dream','Adventure','Magic'])} – Kawaii Illustration", "Automotive/Luxury": f"{random.choice(['Chrome','Midnight','Velocity','Elite'])} – Luxury Automotive Art", } title = titles.get(niche, "Premium Digital Art – Limited Edition") description = f"""🎨 {title} Exclusive AI-generated digital artwork from the DreamFactory collection. ✨ Features: • Ultra-high resolution ready for printing • Perfect for wall art, posters, and merchandise • Unique piece generated with professional prompts • Digital download – instant delivery 📁 You will receive: • High-resolution file • License for personal and commercial use (print-on-demand) 🔖 Tags: {', '.join(tags[:8])} © DreamFactory AI Art. """ marketplace_tags = tags + ["digital art", "AI art", "printable", "wall art", "poster", "home decor"] return title, description, marketplace_tags with gr.Blocks(title="DreamFactory AI Art", theme=gr.themes.Soft()) as demo: gr.Markdown("""# 🏭 DreamFactory AI Art\n### Fully Automated Digital Content Business\n*Zero-touch premium art generation, ready for passive income distribution*""") with gr.Tab("🎨 Generate New Art"): with gr.Row(): niche_dd = gr.Dropdown(choices=list(NICHE_CATALOG.keys()), value="Cyberpunk", label="Art Niche") count_sl = gr.Slider(1, 4, value=1, step=1, label="Batch Count") seed_num = gr.Number(value=0, label="Seed (0=random)", precision=0) gen_btn = gr.Button("✨ GENERATE ART", variant="primary") gallery_out = gr.Gallery(label="Generated Artworks", columns=2, height="auto") meta_json = gr.JSON(label="Generation Metadata") def gen_and_show(niche, count, seed): results = [] for i in range(int(count)): s = int(seed) if seed > 0 else random.randint(1000, 999999) base = NICHE_CATALOG.get(niche, niche) mods = ["masterpiece, ultra detailed, 8k quality, professional","highly detailed, cinematic lighting, award winning art","digital art, trending on artstation, studio quality","hyperdetailed, perfect composition, gallery quality"] prompt = f"{base}, {random.choice(mods)}" res_map = {"Cyberpunk":(1344,576),"Fantasy":(1152,864),"Minimalist Zen":(1024,1024),"Steampunk":(1024,1024),"Cosmic/Abstract":(1024,1536),"Kawaii/Merch":(1024,1024),"Automotive/Luxury":(1680,720)} w,h = res_map.get(niche,(1024,1024)) try: from gradio_client import Client c = Client("mcp-tools/Z-Image-Turbo") result = c.predict(prompt=prompt, resolution=f"{w}x{h}", steps=12, shift=3, seed=s, api_name="/predict") meta = {"prompt":prompt,"niche":niche,"seed":s,"resolution":f"{w}x{h}","date":datetime.now().isoformat(),"tags":base.split(", ")} results.append((result, meta)) except Exception as e: results.append((None, {"error":str(e)})) imgs, metas = [], [] for img, meta in results: if img: imgs.append(img); metas.append(meta) return imgs, metas gen_btn.click(gen_and_show, inputs=[niche_dd, count_sl, seed_num], outputs=[gallery_out, meta_json]) with gr.Tab("📦 Marketplace Export Kit"): gr.Markdown("""### 🚀 Passive Income Workflow\nEvery artwork comes with **pre-formatted metadata** for instant upload to:\n\n1. **Gumroad** – Sell digital downloads\n2. **Etsy** – Sell as digital downloads or POD listings\n3. **Redbubble/Society6** – Auto-sync with print-on-demand products\n4. **Adobe Stock/Shutterstock** – License as stock art\n5. **NFT Marketplaces** – Mint as digital collectibles\n\n**How to automate:** Generate → Export → Bulk upload → Set & forget.""") meta_input = gr.JSON(label="Paste generation metadata", value={"niche": "Cyberpunk", "tags": ["cyberpunk", "neon", "futuristic", "dystopian", "sci-fi"], "prompt": "cyberpunk dragon, neon, futuristic, masterpiece, ultra detailed"}) export_btn = gr.Button("📋 Generate Marketplace Listing") title_out = gr.Textbox(label="Product Title") desc_out = gr.Textbox(label="Product Description", lines=10) tags_out = gr.Textbox(label="Tags (comma-separated)") def do_export(meta): t, d, tags = generate_marketplace_metadata(meta) return t, d, ", ".join(tags) export_btn.click(do_export, inputs=[meta_input], outputs=[title_out, desc_out, tags_out]) with gr.Tab("💰 Monetization Dashboard"): gr.Markdown("""### 💵 Revenue Model (Fully Automated)\n\n| Channel | Effort | Est. Monthly Revenue |\n|---------|--------|---------------------|\n| **Gumroad** digital downloads | Upload once | $200–$500 |\n| **Etsy** digital prints | Upload once + auto-delivery | $300–$800 |\n| **Redbubble** POD | Upload once | $100–$400 |\n| **Adobe Stock** royalties | Upload once | $50–$200 |\n| **NFT collections** | Mint once | Variable |\n\n**Total effort after setup: ZERO.**""") with gr.Tab("🤖 Auto-Mode"): gr.Markdown("""### 🔄 24/7 Content Factory\n\nTo run this business **fully automatically**:\n\n1. **HF Scheduled Jobs** → Generate 10 images/day\n2. **GitHub Actions** → Auto-commit new assets\n3. **Zapier/Make.com** → Auto-post to Gumroad/Etsy\n4. **Social Bots** → Auto-Tweet/Instagram for traffic\n\n**Recommended cron:** `0 */6 * * *` (4 batches/day = 28 artworks/day)\n\n> **Next step:** Say \"activate auto-mode\" and I will write the automation scripts.""") auto_niche = gr.Dropdown(choices=list(NICHE_CATALOG.keys()), value="Cyberpunk", label="Niche for Auto-Gen") auto_count = gr.Slider(1, 10, value=5, label="Images per Batch") activate_btn = gr.Button("🚀 ACTIVATE AUTO-MODE") gr.Markdown("---\n*Built by 🤖 Hugging Face Agent | Business: 100% automated digital content monetization*") if __name__ == "__main__": demo.launch()