File size: 5,956 Bytes
7c7a496
 
 
edc9db2
7c7a496
52577a7
 
7c7a496
 
edc9db2
7ee6ccc
7c7a496
a4e0e99
edc9db2
 
52577a7
 
edc9db2
 
 
7ee6ccc
edc9db2
a4e0e99
edc9db2
 
 
 
 
7c7a496
a4e0e99
ced8182
7c7a496
e694cfe
7c7a496
 
 
 
 
 
 
 
 
 
 
 
e694cfe
 
7c7a496
 
 
 
 
12384bc
d213509
2d4802f
 
 
7c7a496
c90545d
7c7a496
 
7ee6ccc
7c7a496
 
 
7ee6ccc
7c7a496
 
 
7ee6ccc
7c7a496
 
 
7ee6ccc
52577a7
7c7a496
 
 
7ee6ccc
7c7a496
 
 
7ee6ccc
7c7a496
 
 
7ee6ccc
7c7a496
 
 
7ee6ccc
7c7a496
 
 
7ee6ccc
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
97
98
99
100
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/webhooks/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/webhooks/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).

Also check out some generated designs here: https://upperhorizon.github.io/

Note: this setup/model is experimental; if you encounter any bugs/errors, let me know and please try again later...""",
    submit_btn="Generate",
    cache_examples=False,
    examples=[
        [
            '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, award-winning, nature; clean, simple, 2-column, minimal, vector illustration of trees, icons, rounded buttons, soft shadows, earthy tones, colors: olive green, cream, soft brown; sustainability, forest services, eco-friendly',
            None,
        ],
        [
            'header, 1920px, award-winning, e-commerce; clean, minimal, interior furniture graphic, Scandinavian design, earthy vibes textures, subtle elegance, icons, rounded buttons, soft shadows, colors: muted beige, warm brown, soft grey; rug collections, decor store, product sale',
            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,
        ],
        [
            '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,
        ],
        [
            '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, 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()