bardou commited on
Commit
4620fd5
1 Parent(s): efc6c8a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -12
app.py CHANGED
@@ -2,12 +2,16 @@ 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
- "sweet",
10
- "fluffy",
 
 
 
 
11
  ]
12
  MODEL = gr.Interface.load(
13
  "models/artificialguybr/LogoRedmond-LogoLoraForSDXL-V2",
@@ -17,20 +21,23 @@ MODEL = gr.Interface.load(
17
  )
18
 
19
 
20
- def predict(user_prompt: str):
21
- prompt = ", ".join(KEYWORDS)
22
  if user_prompt:
23
- prompt += ", " + user_prompt.lower()
24
 
25
- return MODEL(prompt)
26
 
27
 
28
  select_animal_tab = gr.Interface(
29
  predict,
30
  inputs=[
 
 
 
31
  gr.Dropdown(
32
  choices=ANIMALS, value="Cat", filterable=True, label="Select an animal"
33
- )
34
  ],
35
  outputs=[gr.Image(label="Your super cute animal logo 🥺", show_label=True)],
36
  allow_flagging="never",
@@ -39,10 +46,13 @@ select_animal_tab = gr.Interface(
39
  free_input_tab = gr.Interface(
40
  predict,
41
  inputs=[
 
 
 
42
  gr.Textbox(
43
  placeholder="Enter your corporate keywords",
44
  label="Generate your Teklia logo",
45
- )
46
  ],
47
  outputs=[gr.Image(label="Your super cute corporate logo 🥺", show_label=True)],
48
  allow_flagging="never",
 
2
  import gradio as gr
3
 
4
  ANIMALS = [animal.strip() for animal in Path("animals.txt").read_text().splitlines()]
5
+ KEYWORDS = ["cute", "small", "sweet", "fluffy", "lovable"]
6
+ STYLES = [
7
+ "Minimalism",
8
+ "Retro",
9
+ "Geometric",
10
+ "Flat",
11
+ "Three-dimensional",
12
+ "Illustrated",
13
+ "Photorealism",
14
+ "Watercolor",
15
  ]
16
  MODEL = gr.Interface.load(
17
  "models/artificialguybr/LogoRedmond-LogoLoraForSDXL-V2",
 
21
  )
22
 
23
 
24
+ def predict(styles: list[str], user_prompt: str):
25
+ prompt = ", ".join(KEYWORDS + styles)
26
  if user_prompt:
27
+ prompt += ", " + user_prompt
28
 
29
+ return MODEL(prompt.lower())
30
 
31
 
32
  select_animal_tab = gr.Interface(
33
  predict,
34
  inputs=[
35
+ gr.CheckboxGroup(
36
+ choices=STYLES, value="Illustrated", label="Select styles for your logo"
37
+ ),
38
  gr.Dropdown(
39
  choices=ANIMALS, value="Cat", filterable=True, label="Select an animal"
40
+ ),
41
  ],
42
  outputs=[gr.Image(label="Your super cute animal logo 🥺", show_label=True)],
43
  allow_flagging="never",
 
46
  free_input_tab = gr.Interface(
47
  predict,
48
  inputs=[
49
+ gr.CheckboxGroup(
50
+ choices=STYLES, value="Illustrated", label="Select styles for your logo"
51
+ ),
52
  gr.Textbox(
53
  placeholder="Enter your corporate keywords",
54
  label="Generate your Teklia logo",
55
+ ),
56
  ],
57
  outputs=[gr.Image(label="Your super cute corporate logo 🥺", show_label=True)],
58
  allow_flagging="never",