gbarbadillo commited on
Commit
b2a11c1
β€’
1 Parent(s): 9da6fb4

updated demo to create a single image, and changed order of inputs

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -67,11 +67,11 @@ ip_model = get_ip_model()
67
  app = FaceAnalysis(name="buffalo_l", providers=['CUDAExecutionProvider', 'CPUExecutionProvider'])
68
  app.prepare(ctx_id=0, det_size=(640, 640), det_thresh=0.2)
69
 
70
- def generate_images(img_filepath, prompt, n_images=3,
71
  negative_prompt="monochrome, lowres, bad anatomy, worst quality, low quality, blurry",
72
  img_prompt_scale=0.5,
73
  num_inference_steps=30,
74
- seed=None):
75
  print(prompt)
76
  image = cv2.imread(img_filepath)
77
  faces = app.get(image)
@@ -95,9 +95,8 @@ with gr.Blocks() as demo:
95
  with gr.Row():
96
  with gr.Column():
97
  demo_inputs = []
98
- demo_inputs.append(gr.Image(type='filepath', label='image prompt'))
99
  demo_inputs.append(gr.Textbox(label='text prompt', value='headshot of a man, green moss wall in the background'))
100
- demo_inputs.append(gr.Slider(maximum=3, minimum=1, value=3, step=1, label='number of images'))
101
  with gr.Accordion(label='Advanced options', open=False):
102
  demo_inputs.append(gr.Textbox(label='negative text prompt', value="monochrome, lowres, bad anatomy, worst quality, low quality, blurry"))
103
  demo_inputs.append(gr.Slider(maximum=1, minimum=0, value=0.5, step=0.05, label='image prompt scale'))
@@ -113,6 +112,6 @@ with gr.Blocks() as demo:
113
  'linkedin profile picture of a macdonalds worker',
114
  'LinkedIn profile picture of a beautiful man dressed in a suit, huge explosion in the background',
115
  ]
116
- gr.Examples(sample_prompts, inputs=demo_inputs[1], label='Sample prompts')
117
 
118
  demo.launch(share=True, debug=True)
 
67
  app = FaceAnalysis(name="buffalo_l", providers=['CUDAExecutionProvider', 'CPUExecutionProvider'])
68
  app.prepare(ctx_id=0, det_size=(640, 640), det_thresh=0.2)
69
 
70
+ def generate_images(prompt, img_filepath,
71
  negative_prompt="monochrome, lowres, bad anatomy, worst quality, low quality, blurry",
72
  img_prompt_scale=0.5,
73
  num_inference_steps=30,
74
+ seed=None, n_images=1):
75
  print(prompt)
76
  image = cv2.imread(img_filepath)
77
  faces = app.get(image)
 
95
  with gr.Row():
96
  with gr.Column():
97
  demo_inputs = []
 
98
  demo_inputs.append(gr.Textbox(label='text prompt', value='headshot of a man, green moss wall in the background'))
99
+ demo_inputs.append(gr.Image(type='filepath', label='image prompt'))
100
  with gr.Accordion(label='Advanced options', open=False):
101
  demo_inputs.append(gr.Textbox(label='negative text prompt', value="monochrome, lowres, bad anatomy, worst quality, low quality, blurry"))
102
  demo_inputs.append(gr.Slider(maximum=1, minimum=0, value=0.5, step=0.05, label='image prompt scale'))
 
112
  'linkedin profile picture of a macdonalds worker',
113
  'LinkedIn profile picture of a beautiful man dressed in a suit, huge explosion in the background',
114
  ]
115
+ gr.Examples(sample_prompts, inputs=demo_inputs[0], label='Sample prompts')
116
 
117
  demo.launch(share=True, debug=True)