Iwaku-Real commited on
Commit
a4f8124
1 Parent(s): 31b572b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -4
app.py CHANGED
@@ -94,12 +94,19 @@ def flip_text(prompt, negative_prompt, model, steps, sampler, cfg_scale, width,
94
 
95
  return job["imageUrl"]
96
 
 
 
 
 
 
 
97
  css = """
98
  #generate {
99
  height: 100%;
100
  }
101
  """
102
 
 
103
  with gr.Blocks(css=css) as demo:
104
 
105
 
@@ -130,11 +137,12 @@ with gr.Blocks(css=css) as demo:
130
 
131
  with gr.Row():
132
  with gr.Column(scale=1):
133
- width = gr.Slider(label="Width", minimum=512, maximum=1536, value=1024, step=1)
134
- height = gr.Slider(label="Height", minimum=512, maximum=1536, value=1024, step=1)
 
 
 
135
  gr.Markdown(elem_id="resolution", value="*Max Resolution: 1.1MP (1,100,000px)*")
136
- if width*height < 1_100_000:
137
- gr.Markdown(elem_id="resError", value="### ⚠️ Res too big!")
138
 
139
  with gr.Column(scale=1):
140
  batch_size = gr.Slider(label="Batch Size", maximum=1, value=1)
 
94
 
95
  return job["imageUrl"]
96
 
97
+ def check_res(w, h):
98
+ if w*h < 1_100_000:
99
+ return "### ⚠️ Res too big!"
100
+ else:
101
+ return ""
102
+
103
  css = """
104
  #generate {
105
  height: 100%;
106
  }
107
  """
108
 
109
+
110
  with gr.Blocks(css=css) as demo:
111
 
112
 
 
137
 
138
  with gr.Row():
139
  with gr.Column(scale=1):
140
+ width = gr.Slider(label="Width", minimum=512, maximum=1536, value=1024, step=1, interactive=True)
141
+ height = gr.Slider(label="Height", minimum=512, maximum=1536, value=1024, step=1, interactive=True)
142
+ res_error = gr.Markdown(elem_id="res-error")
143
+ width.change(check_res, [width, height], res_error)
144
+ height.change(check_res, [width, height], res_error)
145
  gr.Markdown(elem_id="resolution", value="*Max Resolution: 1.1MP (1,100,000px)*")
 
 
146
 
147
  with gr.Column(scale=1):
148
  batch_size = gr.Slider(label="Batch Size", maximum=1, value=1)