Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -184,10 +184,35 @@ def preprocess_n_magnify(input_image: Image.Image):
|
|
184 |
preprocessed_img, magnified_img = magnify(preprocessed_img)
|
185 |
|
186 |
return preprocessed_img, (preprocessed_img, magnified_img)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
187 |
|
188 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
def magnify(
|
190 |
input_image: Image.Image,
|
|
|
191 |
user_prompt = "",
|
192 |
positive_prompt = "clean, high-resolution, 8k, best quality, masterpiece",
|
193 |
negative_prompt = "dotted, noise, blur, lowres, oversmooth, longbody, bad anatomy, bad hands, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality",
|
@@ -199,7 +224,7 @@ def magnify(
|
|
199 |
latent_tiled_overlap = 4,
|
200 |
sample_times = 1,
|
201 |
progress=gr.Progress(track_tqdm=True),
|
202 |
-
)
|
203 |
|
204 |
|
205 |
|
|
|
184 |
preprocessed_img, magnified_img = magnify(preprocessed_img)
|
185 |
|
186 |
return preprocessed_img, (preprocessed_img, magnified_img)
|
187 |
+
|
188 |
+
def get_duration(
|
189 |
+
input_image: Image.Image,
|
190 |
+
duration_seconds,
|
191 |
+
user_prompt,
|
192 |
+
positive_prompt,
|
193 |
+
negative_prompt,
|
194 |
+
num_inference_steps,
|
195 |
+
scale_factor,
|
196 |
+
cfg_scale,
|
197 |
+
seed,
|
198 |
+
latent_tiled_size,
|
199 |
+
latent_tiled_overlap,
|
200 |
+
sample_times,
|
201 |
+
progress,
|
202 |
+
):
|
203 |
|
204 |
+
if steps > 4 and duration_seconds > 2:
|
205 |
+
return 90
|
206 |
+
elif steps > 4 or duration_seconds > 2:
|
207 |
+
return 75
|
208 |
+
else:
|
209 |
+
return 60
|
210 |
+
|
211 |
+
|
212 |
+
@spaces.GPU(duration=get_duration)
|
213 |
def magnify(
|
214 |
input_image: Image.Image,
|
215 |
+
duration_seconds = 1,
|
216 |
user_prompt = "",
|
217 |
positive_prompt = "clean, high-resolution, 8k, best quality, masterpiece",
|
218 |
negative_prompt = "dotted, noise, blur, lowres, oversmooth, longbody, bad anatomy, bad hands, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality",
|
|
|
224 |
latent_tiled_overlap = 4,
|
225 |
sample_times = 1,
|
226 |
progress=gr.Progress(track_tqdm=True),
|
227 |
+
):
|
228 |
|
229 |
|
230 |
|