Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,35 +1,56 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
KEYWORDS = [
|
7 |
"cute",
|
8 |
"small",
|
9 |
"cartoon",
|
10 |
]
|
11 |
-
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
14 |
|
15 |
|
16 |
def predict(user_prompt: str):
|
17 |
prompt = ", ".join(KEYWORDS)
|
18 |
if user_prompt:
|
19 |
-
prompt += ", " + user_prompt
|
|
|
|
|
20 |
|
21 |
-
return PIPELINE(prompt).images[0]
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
-
|
25 |
predict,
|
26 |
inputs=[
|
27 |
-
gr.Textbox(
|
|
|
|
|
|
|
28 |
],
|
29 |
-
outputs=[gr.Image()],
|
30 |
-
|
31 |
)
|
32 |
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
if __name__ == "__main__":
|
35 |
-
|
|
|
1 |
+
from pathlib import Path
|
2 |
import gradio as gr
|
3 |
|
4 |
+
ANIMALS = [animal.strip() for animal in Path("animals.txt").read_text().splitlines()]
|
|
|
|
|
5 |
KEYWORDS = [
|
6 |
"cute",
|
7 |
"small",
|
8 |
"cartoon",
|
9 |
]
|
10 |
+
MODEL = gr.Interface.load(
|
11 |
+
"models/artificialguybr/LogoRedmond-LogoLoraForSDXL-V2",
|
12 |
+
live=False,
|
13 |
+
preprocess=True,
|
14 |
+
postprocess=False,
|
15 |
+
)
|
16 |
|
17 |
|
18 |
def predict(user_prompt: str):
|
19 |
prompt = ", ".join(KEYWORDS)
|
20 |
if user_prompt:
|
21 |
+
prompt += ", " + user_prompt.lower()
|
22 |
+
|
23 |
+
return MODEL(prompt)
|
24 |
|
|
|
25 |
|
26 |
+
select_animal_tab = gr.Interface(
|
27 |
+
predict,
|
28 |
+
inputs=[
|
29 |
+
gr.Dropdown(
|
30 |
+
choices=ANIMALS, value="Cat", filterable=True, label="Select an animal"
|
31 |
+
)
|
32 |
+
],
|
33 |
+
outputs=[gr.Image(label="Your super cute animal logo 🥺", show_label=True)],
|
34 |
+
allow_flagging="never",
|
35 |
+
)
|
36 |
|
37 |
+
free_input_tab = gr.Interface(
|
38 |
predict,
|
39 |
inputs=[
|
40 |
+
gr.Textbox(
|
41 |
+
placeholder="Enter your corporate keywords",
|
42 |
+
label="Generate your Teklia logo",
|
43 |
+
)
|
44 |
],
|
45 |
+
outputs=[gr.Image(label="Your super cute corporate logo 🥺", show_label=True)],
|
46 |
+
allow_flagging="never",
|
47 |
)
|
48 |
|
49 |
+
qte_app = gr.TabbedInterface(
|
50 |
+
[select_animal_tab, free_input_tab],
|
51 |
+
tab_names=["Cuteness overload", "TekQ-te"],
|
52 |
+
title="Q-te logo creator",
|
53 |
+
)
|
54 |
|
55 |
if __name__ == "__main__":
|
56 |
+
qte_app.launch()
|