File size: 1,741 Bytes
841064d
ed21143
 
841064d
4620fd5
 
 
 
 
 
 
 
 
 
a388239
841064d
 
 
 
 
 
a388239
 
4620fd5
 
a388239
4620fd5
841064d
4620fd5
a388239
 
841064d
 
 
4620fd5
 
 
841064d
 
4620fd5
841064d
 
 
 
a388239
841064d
a388239
 
4620fd5
 
 
841064d
 
 
4620fd5
a388239
841064d
 
a388239
 
841064d
 
 
 
 
a388239
 
841064d
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
from pathlib import Path
import gradio as gr

ANIMALS = [animal.strip() for animal in Path("animals.txt").read_text().splitlines()]
KEYWORDS = ["cute", "small", "sweet", "fluffy", "lovable"]
STYLES = [
    "Minimalism",
    "Retro",
    "Geometric",
    "Flat",
    "Three-dimensional",
    "Illustrated",
    "Photorealism",
    "Watercolor",
]
MODEL = gr.Interface.load(
    "models/artificialguybr/LogoRedmond-LogoLoraForSDXL-V2",
    live=False,
    preprocess=True,
    postprocess=False,
)


def predict(styles: list[str], user_prompt: str):
    prompt = ", ".join(KEYWORDS + styles)
    if user_prompt:
        prompt += ", " + user_prompt

    return MODEL(prompt.lower())


select_animal_tab = gr.Interface(
    predict,
    inputs=[
        gr.CheckboxGroup(
            choices=STYLES, value="Illustrated", label="Select styles for your logo"
        ),
        gr.Dropdown(
            choices=ANIMALS, value="Cat", filterable=True, label="Select an animal"
        ),
    ],
    outputs=[gr.Image(label="Your super cute animal logo 🥺", show_label=True)],
    allow_flagging="never",
)

free_input_tab = gr.Interface(
    predict,
    inputs=[
        gr.CheckboxGroup(
            choices=STYLES, value="Illustrated", label="Select styles for your logo"
        ),
        gr.Textbox(
            placeholder="Enter your corporate keywords",
            label="Generate your Teklia logo",
        ),
    ],
    outputs=[gr.Image(label="Your super cute corporate logo 🥺", show_label=True)],
    allow_flagging="never",
)

qte_app = gr.TabbedInterface(
    [select_animal_tab, free_input_tab],
    tab_names=["Cuteness overload", "TekQ-te"],
    title="Q-te logo creator",
)

if __name__ == "__main__":
    qte_app.launch()