lichorosario commited on
Commit
c70a26e
1 Parent(s): 113b7ab

se agregó upscale

Browse files
Files changed (1) hide show
  1. app.py +39 -1
app.py CHANGED
@@ -2,6 +2,7 @@ import os
2
  import gradio as gr
3
  import json
4
  from gradio_client import Client
 
5
 
6
  with open('loras.json', 'r') as f:
7
  loras = json.load(f)
@@ -63,6 +64,20 @@ def update_selection(evt: gr.SelectData):
63
  evt.index
64
  )
65
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  css="""
67
  """
68
 
@@ -119,6 +134,18 @@ with gr.Blocks(css=css) as demo:
119
  step=32,
120
  value=1024,
121
  )
 
 
 
 
 
 
 
 
 
 
 
 
122
 
123
  with gr.Row():
124
  seed = gr.Slider(
@@ -152,7 +179,11 @@ with gr.Blocks(css=css) as demo:
152
 
153
  submit_btn = gr.Button("Submit")
154
  cancel_btn = gr.Button("Cancel")
155
- image_out = gr.Image(label="Image output")
 
 
 
 
156
  selected_index = gr.State(None)
157
 
158
  submit_btn.click(
@@ -164,6 +195,13 @@ with gr.Blocks(css=css) as demo:
164
  fn=cancel_infer,
165
  outputs=[]
166
  )
 
 
 
 
 
 
 
167
  gallery.select(update_selection, outputs=[prompt_in, selected_info, selected_index])
168
 
169
  demo.launch()
 
2
  import gradio as gr
3
  import json
4
  from gradio_client import Client
5
+ from gradio_imageslider import ImageSlider
6
 
7
  with open('loras.json', 'r') as f:
8
  loras = json.load(f)
 
64
  evt.index
65
  )
66
 
67
+
68
+ def upscale(image, resolution, inf_steps, strength, hdr_effect, guidance_scale):
69
+ client = Client("gokaygokay/Tile-Upscaler")
70
+ result = client.predict(
71
+ param_0=image,
72
+ param_1=resolution,
73
+ param_2=inf_steps,
74
+ param_3=strength,
75
+ param_4=hdr_effect,
76
+ param_5=guidance_scale,
77
+ api_name="/wrapper"
78
+ )
79
+ return result
80
+
81
  css="""
82
  """
83
 
 
134
  step=32,
135
  value=1024,
136
  )
137
+
138
+ examples = [
139
+ [1024,512],
140
+ [2048,512],
141
+ [3072, 512]
142
+ ]
143
+ gr.Examples(
144
+ label="Presets",
145
+ examples=examples,
146
+ inputs=[width, height],
147
+ outputs=[]
148
+ )
149
 
150
  with gr.Row():
151
  seed = gr.Slider(
 
179
 
180
  submit_btn = gr.Button("Submit")
181
  cancel_btn = gr.Button("Cancel")
182
+ with gr.Row():
183
+ image_out = gr.Image(label="Image output")
184
+ image_upscaled = ImageSlider(label="Before / After", type="numpy")
185
+ scale_btn = gr.Button("Upscale")
186
+
187
  selected_index = gr.State(None)
188
 
189
  submit_btn.click(
 
195
  fn=cancel_infer,
196
  outputs=[]
197
  )
198
+ scale_btn.click(
199
+ fn=upscale,
200
+ inputs=[image_out, 768, 25, 0,4, 0.3, 7.5],
201
+ outputs=[image_upscaled]
202
+ )
203
+
204
+
205
  gallery.select(update_selection, outputs=[prompt_in, selected_info, selected_index])
206
 
207
  demo.launch()