CiaraRowles commited on
Commit
0f33a11
·
verified ·
1 Parent(s): 6f20b44

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -21,7 +21,7 @@ device = "cuda"
21
  cv2.setNumThreads(1)
22
 
23
  @spaces.GPU(enable_queue=True)
24
- def generate_image(images, prompt, negative_prompt, progress=gr.Progress(track_tqdm=True)):
25
 
26
 
27
 
@@ -34,12 +34,12 @@ def generate_image(images, prompt, negative_prompt, progress=gr.Progress(track_
34
  # Calculate new width and height
35
 
36
 
37
- image = process_single_image_both_ways(ip_ckpt,image_path="",prompt=prompt,num_inference_steps=20,image=image)
38
 
39
  yield image
40
 
41
  @spaces.GPU(enable_queue=True)
42
- def make_stylecode (images, progress=gr.Progress(track_tqdm=True)):
43
  code = make_stylecode(ip_ckpt,images)
44
  return code
45
 
@@ -75,10 +75,10 @@ with gr.Blocks(css=css) as demo:
75
  with gr.Column():
76
  gallery = gr.Gallery(label="Generated Images")
77
 
78
- stylecode_gen.click(fn=make_stylecode,inputs=[files],outputs=stylecode)
79
 
80
  submit.click(fn=generate_image,
81
- inputs=[files, prompt, negative_prompt],
82
  outputs=gallery)
83
 
84
  gr.Markdown("This demo includes extra features to mitigate the implicit bias of the model and prevent explicit usage of it to generate content with faces of people, including third parties, that is not safe for all audiences, including naked or semi-naked people.")
 
21
  cv2.setNumThreads(1)
22
 
23
  @spaces.GPU(enable_queue=True)
24
+ def generate_image(images, prompt, negative_prompt,stylecode, progress=gr.Progress(track_tqdm=True)):
25
 
26
 
27
 
 
34
  # Calculate new width and height
35
 
36
 
37
+ image = process_single_image(ip_ckpt,image_path="",prompt=prompt,num_inference_steps=20,image=image,stylecode=stylecode)
38
 
39
  yield image
40
 
41
  @spaces.GPU(enable_queue=True)
42
+ def make_stylecode_gui (images, progress=gr.Progress(track_tqdm=True)):
43
  code = make_stylecode(ip_ckpt,images)
44
  return code
45
 
 
75
  with gr.Column():
76
  gallery = gr.Gallery(label="Generated Images")
77
 
78
+ stylecode_gen.click(fn=make_stylecode_gui,inputs=[files],outputs=stylecode)
79
 
80
  submit.click(fn=generate_image,
81
+ inputs=[files, prompt, negative_prompt,stylecode],
82
  outputs=gallery)
83
 
84
  gr.Markdown("This demo includes extra features to mitigate the implicit bias of the model and prevent explicit usage of it to generate content with faces of people, including third parties, that is not safe for all audiences, including naked or semi-naked people.")