DigiP-AI commited on
Commit
de32577
·
verified ·
1 Parent(s): d9a533d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -50,6 +50,8 @@ API_TOKEN = os.getenv("HF_READ_TOKEN")
50
  headers = {"Authorization": f"Bearer {API_TOKEN}"}
51
  timeout = 100
52
 
 
 
53
 
54
  def query(lora_id, prompt, is_negative=False, steps=28, cfg_scale=3.5, sampler="DPM++ 2M Karras", seed=-1, strength=0.7, width=1024, height=1024):
55
  if prompt == "" or prompt == None:
@@ -196,15 +198,13 @@ with gr.Blocks(theme=theme, css=css, elem_id="app-container") as app:
196
 
197
  text_button.click(query, inputs=[custom_lora, text_prompt, negative_prompt, steps, cfg, method, seed, strength, width, height], outputs=[image_output, seed_output])
198
 
199
- with gr.Tab("Image Upscaler"):
200
  with gr.Row():
201
- with gr.Column():
202
- def upscale_image(input_image, radio_input):
203
- upscale_factor = radio_input
204
- output_image = cv2.resize(input_image, None, fx = upscale_factor, fy = upscale_factor, interpolation = cv2.INTER_CUBIC)
205
- return output_image
206
- radio_input = gr.Radio(label="Upscale Levels", choices=[2, 4, 6, 8, 10], value=2)
207
- iface = gr.Interface(fn=upscale_image, inputs = [gr.Image(label="Input Image", interactive=True), radio_input], outputs = gr.Image(label="Upscaled Image", format="png"), title="Image Upscaler")
208
-
209
  if __name__ == "__main__":
210
  app.launch(show_api=False, share=False)
 
50
  headers = {"Authorization": f"Bearer {API_TOKEN}"}
51
  timeout = 100
52
 
53
+ def flip_image(x):
54
+ return np.fliplr(x)
55
 
56
  def query(lora_id, prompt, is_negative=False, steps=28, cfg_scale=3.5, sampler="DPM++ 2M Karras", seed=-1, strength=0.7, width=1024, height=1024):
57
  if prompt == "" or prompt == None:
 
198
 
199
  text_button.click(query, inputs=[custom_lora, text_prompt, negative_prompt, steps, cfg, method, seed, strength, width, height], outputs=[image_output, seed_output])
200
 
201
+ with gr.Tab("Flip Image"):
202
  with gr.Row():
203
+ image_input = gr.Image()
204
+ image_output = gr.Image(format="png")
205
+ with gr.Row():
206
+ image_button = gr.Button("Run", variant='primary')
207
+ image_button.click(flip_image, inputs=image_input, outputs=image_output)
208
+
 
 
209
  if __name__ == "__main__":
210
  app.launch(show_api=False, share=False)