Krebzonide commited on
Commit
2939163
·
1 Parent(s): 080f603

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -8
app.py CHANGED
@@ -69,11 +69,11 @@ def set_base_model(base_model_id):
69
  pipe.to("cuda")
70
  return pipe
71
 
72
- def update_pixel_ratio(height, width):
73
- return round(height*width/1048576,3)
74
 
75
  def round_to_8(num):
76
- return num - (num % 8)
77
 
78
  examples = [
79
  ['A serious capybara at work, wearing a suit',
@@ -110,11 +110,8 @@ with gr.Blocks(css=css) as demo:
110
  gallery = gr.Gallery(label="Generated images", height=800)
111
  ex = gr.Examples(examples=examples, inputs=[prompt, negative_prompt])
112
  submit_btn.click(generate, [prompt, negative_prompt, samp_steps, guide_scale, batch_size, seed, height, width], [gallery], queue=True)
113
- height.release(update_pixel_ratio, [height, width], [pixels], queue=False)
114
- height.input(round_to_8, [height], [height], queue=False)
115
- width.release(update_pixel_ratio, [height, width], [pixels], queue=False)
116
- width.input(round_to_8, [width], [width], queue=False)
117
-
118
 
119
  pipe = set_base_model(model_id)
120
  demo.launch(debug=True)
 
69
  pipe.to("cuda")
70
  return pipe
71
 
72
+ def update_pixel_ratio(num1, num2):
73
+ return [round(num1*num2/1048576,3), num1-(num1%8)]
74
 
75
  def round_to_8(num):
76
+ return
77
 
78
  examples = [
79
  ['A serious capybara at work, wearing a suit',
 
110
  gallery = gr.Gallery(label="Generated images", height=800)
111
  ex = gr.Examples(examples=examples, inputs=[prompt, negative_prompt])
112
  submit_btn.click(generate, [prompt, negative_prompt, samp_steps, guide_scale, batch_size, seed, height, width], [gallery], queue=True)
113
+ height.release(update_pixel_ratio, [height, width], [pixels, height], queue=False)
114
+ width.release(update_pixel_ratio, [width, height], [pixels, width], queue=False)
 
 
 
115
 
116
  pipe = set_base_model(model_id)
117
  demo.launch(debug=True)