File size: 6,036 Bytes
7c7a496
 
 
edc9db2
7c7a496
52577a7
 
7c7a496
 
edc9db2
7c7a496
 
a4e0e99
edc9db2
 
52577a7
 
edc9db2
 
 
 
 
a4e0e99
edc9db2
 
 
 
 
7c7a496
a4e0e99
ced8182
7c7a496
e694cfe
7c7a496
 
 
 
 
 
 
 
 
 
 
 
e694cfe
 
7c7a496
 
 
 
 
 
 
c90545d
7c7a496
 
52577a7
7c7a496
 
 
52577a7
7c7a496
 
 
52577a7
7c7a496
 
 
52577a7
 
7c7a496
 
 
52577a7
7c7a496
 
 
52577a7
7c7a496
 
 
52577a7
7c7a496
 
 
52577a7
7c7a496
 
 
52577a7
7c7a496
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import gradio as gr
import requests
import numpy as np
from time import sleep

max_attempts = 12


def run(prompt, token):
    job = requests.post(
        "https://api.workranked.com/ai-web-design",
        data={"prompt": prompt, "token": token},
    ).json()["data"]["job"]

    result = {}
    for attempt in range(0, max_attempts):
        gr.Info(f"Waiting for results (attempt {attempt + 1} of {max_attempts})")
        sleep(10)

        result = requests.post(
            f"https://api.workranked.com/ai-web-design-result",
            data={"job": job},
        ).json()["data"]
        if result.get("output"):
            break

    if not result.get("output"):
        gr.Error("Sorry, your request timed out. Please try again later...")

    images = result.get("output", {}).get("images")
    image = np.array(images[0]) if images else None

    return image


gr.Interface(
    fn=run,
    inputs=[
        gr.Textbox(
            label="Text Prompt",
            lines=3,
            info="For the best results, try formatting your prompt similar to the examples below",
        ),
        gr.Textbox(label="Secret Token"),
    ],
    outputs=gr.Image(label="AI-generated Image"),
    # gr.Number(label="Generations Remaining"),
    title="AI Web Design Demo",
    description="""Try out a text-to-image AI model specifically trained to generate website designs and graphics.

[Subscribe here](https://upperhorizon.com/waitlist-wd?utm_campaign=gradio-demo) to get updates on the development and release of this tool.

Have an idea or suggestion? Provide feedback directly to me (the developer) at [hello@upperhorizon.com](mailto:hello@upperhorizon.com).""",
    submit_btn="Generate",
    cache_examples=False,
    examples=[
        [
            "header, 1920px, award winning, food; modern, eco friendly, clean design, subtle divider lines, sans serif fonts, minimalistic, nature themed, images of jars and leaves, earthy tones, colors: olive green, cream, soft brown; sustainability, eco friendly, packaging, recycling, food waste, environmental protection, honey products, innovation, conservation, community, recipes, composting, green initiatives",
            None,
        ],
        [
            "header, 1920px, award-winning, community; clean, simple, 2-column, minimal, playful, pastel vibes, vector illustration of graph, icons, rounded buttons, soft shadows, colors: yellow, white, black; reporting analytics, data dashboards, employee engagement, trends, recognition, free trial, peer feedback, integrations, Slack, Microsoft Teams, custom rewards",
            None,
        ],
        [
            "header, 1920px, detailed, award-winning, e-commerce; natural textures, minimalist, neutral tones, modern, clean layout, Scandinavian design, earthy vibes, subtle elegance, images: cozy interiors, muted beige, warm brown, soft grey; rug collections, classic styles, heirloom, new arrivals, sale, samples, custom, cart, wishlist, sustainable, B Corporation, home decor, interior design, online shopping",
            None,
        ],
        [
            "1920px, award-winning, detailed; purple background, bold sans-serif text, minimalist, two-column layout, app store buttons, centered elements, playful, modern, clean design, colors: pastel purple, white, black; templates, marketplace, pricing, download, connect socials, monetize, audience building, analytics, creators, influencers, small businesses, e-commerce, mobile app, community",
            # "homepage, 1920px, award-winning, tech\nminimalist, playful, modern, clean design, bold sans-serif text, colors: pastel purple, white, black\nanalytics, small businesses, e-commerce, marketplace, audience building, pricing, download, connect socials, monetize, creators, influencers, mobile app, community",
            None,
        ],
        [
            "header, homepage, 1920px, award-winning, shopping; minimalist, dark mode, flat vector graphic of film camera, tech-focused, monochrome elements, black, orange accents, modern design, futuristic vibe; cinematic gear, motor upgrade, camera control, training app, testimonials, demos, creative filmmaking, film production technology, wireless control, virtual production tools, third axis control",
            None,
        ],
        [
            "homepage, 1920px, tech startup, detailed, space; industrial space theme, scientific, modern, technical vibes, large serif text, colors: deep black, cosmic gray, bright red accents; space exploration, robotics, technology development, scientific research, missions, educational resources, planetary studies, climate change",
            None,
        ],
        [
            "header, homepage, 1920px, detailed, award-winning, non-profit; classical, grayscale, academic theme, clean design, serif fonts, overlapping images, geometric accents, neutral tones, colors: muted teal, brick red, classic tan; research programs, antitrust, consumer protection, data security, privacy, financial regulation, innovation, intellectual property, telecommunications, publications, events, policy debates",
            None,
        ],
        [
            "homepage, 1920px, highly detailed; colorful futuristic, vibrant neon green, deep purple, holographic elements, tech-themed, 3D graphics of phones and rings, single bold column, minimal text, playful, modern, floating objects, abstract shapes; financial services, money management, peer-to-peer payments, stock investment, discounts, banking apps, prepaid debit cards, tax filing",
            None,
        ],
        [
            "header, homepage, 1920px, detailed, award-winning, best visuals; sleek, minimalist, dark mode, monochrome, modern, tech-themed, large hero image, aesthetic, 2-column layout, rounded buttons, seamless transitions, bold typography, dynamic, colors: black, white, violet accents; creative collaboration, media sharing, feedback tracking, cloud-based platform, video editing, production workflow, file transfer",
            None,
        ],
    ],
).launch()