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

ANIMALS = [animal.strip() for animal in Path("animals.txt").read_text().splitlines()]
KEYWORDS = [
    "cute",
    "small",
    "cartoon",
]
MODEL = gr.Interface.load(
    "models/artificialguybr/LogoRedmond-LogoLoraForSDXL-V2",
    live=False,
    preprocess=True,
    postprocess=False,
)


def predict(user_prompt: str):
    prompt = ", ".join(KEYWORDS)
    if user_prompt:
        prompt += ", " + user_prompt.lower()

    return MODEL(prompt)


select_animal_tab = gr.Interface(
    predict,
    inputs=[
        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.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()