Jonny001 commited on
Commit
5808f1f
·
verified ·
1 Parent(s): 160cf01

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -7
app.py CHANGED
@@ -3,21 +3,27 @@ import random
3
 
4
  model = gr.load("models/Purz/face-projection")
5
 
6
- def generate_image(text, negative_prompt):
7
- return model(text, negative_prompt=negative_prompt)
 
 
 
 
 
 
8
 
9
  examples = [
10
- ["Humanoid Cat Warrior, Full View", "No background"],
11
- ["Warhammer Sisterhood", "No weapons"],
12
- ["Future Robots war", "No destruction"],
13
- ["Fantasy dragon", "No fire"],
14
  ]
15
 
16
  interface = gr.Interface(
17
  fn=generate_image,
18
  inputs=[
19
  gr.Textbox(label="Type here your imagination:", placeholder="Type or click an example..."),
20
- gr.Textbox(label="Negative Prompt (optional):", placeholder="Specify what to avoid..."),
21
  ],
22
  outputs=gr.Image(label="Generated Image"),
23
  examples=examples,
 
3
 
4
  model = gr.load("models/Purz/face-projection")
5
 
6
+ def generate_image(text, seed):
7
+ if seed is not None:
8
+ random.seed(seed)
9
+
10
+ if text in [example[0] for example in examples]:
11
+ print(f"Using example: {text}")
12
+
13
+ return model(text)
14
 
15
  examples = [
16
+ ["Humanoid Cat Warrior, Full View", None],
17
+ ["Warhammer Sisterhood", None],
18
+ ["Future Robots war", None],
19
+ ["Fantasy dragon", None]
20
  ]
21
 
22
  interface = gr.Interface(
23
  fn=generate_image,
24
  inputs=[
25
  gr.Textbox(label="Type here your imagination:", placeholder="Type or click an example..."),
26
+ gr.Slider(minimum=0, maximum=10000, step=1, label="Seed (optional)")
27
  ],
28
  outputs=gr.Image(label="Generated Image"),
29
  examples=examples,