c-o-s commited on
Commit
ad37662
ยท
1 Parent(s): 097e86c

Update app.py

Browse files

added gallery for output simulation

Files changed (1) hide show
  1. app.py +16 -5
app.py CHANGED
@@ -1,9 +1,9 @@
1
  import gradio as gr
2
- import os
3
 
4
  sex_value = ""
5
  age_value = 0
6
 
 
7
  def prompt(user_upload, name, sex_value, age_value):
8
 
9
  if sex_value == "male":
@@ -13,21 +13,32 @@ def prompt(user_upload, name, sex_value, age_value):
13
  else:
14
  sex = "nutral person"
15
 
16
- return "RAW photo, VAR TRIGGERWORD, photo a " + sex + ",wearing a suit, " + str(age_value) + " years old,standing on a huge stage, energetic pose, wide shot, huge american flag in background, stage lighting --n (deformed iris, deformed pupils, semi-realistic, cgi, 3d, render, sketch, cartoon, drawing, anime, mutated hands and fingers:1.4), (deformed, distorted, disfigured:1.3), poorly drawn, bad anatomy, wrong anatomy, extra limb, missing limb, floating limbs, disconnected limbs, mutation, mutated, ugly, disgusting, amputation", name
 
 
 
 
 
 
 
 
17
 
18
 
19
  demo = gr.Interface(
20
  fn=prompt,
21
  inputs=[
22
- gr.Files(label="upload 10 pics", file_count="multiple", file_types=["image", ".jpg"]),
 
23
  gr.Textbox(label="name"),
24
  gr.Radio(["male", "female", "none binary"], label="sex"),
25
  gr.Slider(18, 99, step=1, label="age")
26
- ],
27
  outputs=[
28
  gr.Textbox(label="prompt"),
29
  gr.Textbox(label="name"),
 
 
30
  ]
31
  )
32
 
33
- demo.launch()
 
1
  import gradio as gr
 
2
 
3
  sex_value = ""
4
  age_value = 0
5
 
6
+
7
  def prompt(user_upload, name, sex_value, age_value):
8
 
9
  if sex_value == "male":
 
13
  else:
14
  sex = "nutral person"
15
 
16
+ processed_output=[
17
+ "output/demo1.jpg",
18
+ "output/demo2.jpg",
19
+ "output/demo3.jpg",
20
+ "output/demo4.jpg",
21
+ "output/demo5.jpg"
22
+ ]
23
+
24
+ return f"RAW photo, VAR TRIGGERWORD, photo a {sex} ,wearing a suit, {age_value} years old,standing on a huge stage, energetic pose, wide shot, huge american flag in background, stage lighting --n (deformed iris, deformed pupils, semi-realistic, cgi, 3d, render, sketch, cartoon, drawing, anime, mutated hands and fingers:1.4), (deformed, distorted, disfigured:1.3), poorly drawn, bad anatomy, wrong anatomy, extra limb, missing limb, floating limbs, disconnected limbs, mutation, mutated, ugly, disgusting, amputation", name, processed_output
25
 
26
 
27
  demo = gr.Interface(
28
  fn=prompt,
29
  inputs=[
30
+ gr.Files(label="upload 10 pics", file_count="directory", file_types=["image", ".jpg"]),
31
+ #gr.Button(value="load demo files"),
32
  gr.Textbox(label="name"),
33
  gr.Radio(["male", "female", "none binary"], label="sex"),
34
  gr.Slider(18, 99, step=1, label="age")
35
+ ],
36
  outputs=[
37
  gr.Textbox(label="prompt"),
38
  gr.Textbox(label="name"),
39
+ gr.Gallery(label="processed images", columns=[3])
40
+ #gr.Textbox(label="file list")
41
  ]
42
  )
43
 
44
+ demo.launch(share=True)