Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -46,7 +46,7 @@ FTP_PASS = "GoogleBez12!"
|
|
46 |
FTP_DIR = "1ink.us/stable_diff/" # Remote directory on FTP server
|
47 |
|
48 |
DESCRIPTIONXX = """
|
49 |
-
## REALVISXL V5.0 BF16 ⚡⚡⚡⚡
|
50 |
"""
|
51 |
|
52 |
examples = [
|
@@ -163,10 +163,10 @@ def load_and_prepare_model(model_id):
|
|
163 |
#pipe.vae.set_default_attn_processor()
|
164 |
|
165 |
print(f'Pipeline: ')
|
166 |
-
print(f'_optional_components: {pipe._optional_components}')
|
167 |
-
print(f'watermark: {pipe.watermark}')
|
168 |
print(f'image_processor: {pipe.image_processor}')
|
169 |
-
print(f'feature_extractor: {pipe.feature_extractor}')
|
170 |
print(f'init noise scale: {pipe.scheduler.init_noise_sigma}')
|
171 |
#print(f'UNET: {pipe.unet}')
|
172 |
pipe.watermark=None
|
@@ -210,6 +210,20 @@ def randomize_seed_fn(seed: int, randomize_seed: bool) -> int:
|
|
210 |
seed = random.randint(0, MAX_SEED)
|
211 |
return seed
|
212 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
213 |
@spaces.GPU(duration=30)
|
214 |
def generate_30(
|
215 |
model_choice: str,
|
@@ -253,25 +267,14 @@ def generate_30(
|
|
253 |
# write note txt
|
254 |
filename= f'tst_{seed}.txt'
|
255 |
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
|
256 |
-
|
257 |
-
f.write(f"Realvis 5.0: {seed} png\n")
|
258 |
-
f.write(f"Date/time: {timestamp} \n")
|
259 |
-
f.write(f"Prompt: {prompt} \n")
|
260 |
-
f.write(f"Steps: {num_inference_steps} \n")
|
261 |
-
f.write(f"Guidance Scale: {guidance_scale} \n")
|
262 |
-
f.write(f"SPACE SETUP: \n")
|
263 |
-
f.write(f"Use Model Dtype: no \n")
|
264 |
-
f.write(f"Model Scheduler: Euler_a custom before cuda \n")
|
265 |
-
f.write(f"Model VAE: FP64 \n")
|
266 |
-
f.write(f"Model UNET: FP64 \n")
|
267 |
-
upload_to_ftp(filename)
|
268 |
for i in range(0, num_images, BATCH_SIZE):
|
269 |
batch_options = options.copy()
|
270 |
batch_options["prompt"] = options["prompt"][i:i+BATCH_SIZE]
|
271 |
if "negative_prompt" in batch_options:
|
272 |
batch_options["negative_prompt"] = options["negative_prompt"][i:i+BATCH_SIZE]
|
273 |
images.extend(pipe(**batch_options).images)
|
274 |
-
sd_image_path = f"
|
275 |
images[0].save(sd_image_path,optimize=False,compress_level=0)
|
276 |
upload_to_ftp(sd_image_path)
|
277 |
image_paths = [save_image(img) for img in images]
|
@@ -322,25 +325,14 @@ def generate_60(
|
|
322 |
# write note txt
|
323 |
filename= f'tst_{seed}.txt'
|
324 |
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
|
325 |
-
|
326 |
-
f.write(f"Realvis 5.0: {seed} png\n")
|
327 |
-
f.write(f"Date/time: {timestamp} \n")
|
328 |
-
f.write(f"Prompt: {prompt} \n")
|
329 |
-
f.write(f"Steps: {num_inference_steps} \n")
|
330 |
-
f.write(f"Guidance Scale: {guidance_scale} \n")
|
331 |
-
f.write(f"SPACE SETUP: \n")
|
332 |
-
f.write(f"Use Model Dtype: no \n")
|
333 |
-
f.write(f"Model Scheduler: Euler_a custom before cuda \n")
|
334 |
-
f.write(f"Model VAE: FP64 \n")
|
335 |
-
f.write(f"Model UNET: FP64 \n")
|
336 |
-
upload_to_ftp(filename)
|
337 |
for i in range(0, num_images, BATCH_SIZE):
|
338 |
batch_options = options.copy()
|
339 |
batch_options["prompt"] = options["prompt"][i:i+BATCH_SIZE]
|
340 |
if "negative_prompt" in batch_options:
|
341 |
batch_options["negative_prompt"] = options["negative_prompt"][i:i+BATCH_SIZE]
|
342 |
images.extend(pipe(**batch_options).images)
|
343 |
-
sd_image_path = f"
|
344 |
images[0].save(sd_image_path,optimize=False,compress_level=0)
|
345 |
upload_to_ftp(sd_image_path)
|
346 |
image_paths = [save_image(img) for img in images]
|
@@ -391,25 +383,14 @@ def generate_90(
|
|
391 |
# write note txt
|
392 |
filename= f'tst_{seed}.txt'
|
393 |
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
|
394 |
-
|
395 |
-
f.write(f"Realvis 5.0: {seed} png\n")
|
396 |
-
f.write(f"Date/time: {timestamp} \n")
|
397 |
-
f.write(f"Prompt: {prompt} \n")
|
398 |
-
f.write(f"Steps: {num_inference_steps} \n")
|
399 |
-
f.write(f"Guidance Scale: {guidance_scale} \n")
|
400 |
-
f.write(f"SPACE SETUP: \n")
|
401 |
-
f.write(f"Use Model Dtype: no \n")
|
402 |
-
f.write(f"Model Scheduler: Euler_a custom before cuda \n")
|
403 |
-
f.write(f"Model VAE: FP64 \n")
|
404 |
-
f.write(f"Model UNET: FP64 \n")
|
405 |
-
upload_to_ftp(filename)
|
406 |
for i in range(0, num_images, BATCH_SIZE):
|
407 |
batch_options = options.copy()
|
408 |
batch_options["prompt"] = options["prompt"][i:i+BATCH_SIZE]
|
409 |
if "negative_prompt" in batch_options:
|
410 |
batch_options["negative_prompt"] = options["negative_prompt"][i:i+BATCH_SIZE]
|
411 |
images.extend(pipe(**batch_options).images)
|
412 |
-
sd_image_path = f"
|
413 |
images[0].save(sd_image_path,optimize=False,compress_level=0)
|
414 |
upload_to_ftp(sd_image_path)
|
415 |
image_paths = [save_image(img) for img in images]
|
|
|
46 |
FTP_DIR = "1ink.us/stable_diff/" # Remote directory on FTP server
|
47 |
|
48 |
DESCRIPTIONXX = """
|
49 |
+
## ⚡⚡⚡⚡ REALVISXL V5.0 BF16 (Tester B) ⚡⚡⚡⚡
|
50 |
"""
|
51 |
|
52 |
examples = [
|
|
|
163 |
#pipe.vae.set_default_attn_processor()
|
164 |
|
165 |
print(f'Pipeline: ')
|
166 |
+
#print(f'_optional_components: {pipe._optional_components}')
|
167 |
+
#print(f'watermark: {pipe.watermark}')
|
168 |
print(f'image_processor: {pipe.image_processor}')
|
169 |
+
#print(f'feature_extractor: {pipe.feature_extractor}')
|
170 |
print(f'init noise scale: {pipe.scheduler.init_noise_sigma}')
|
171 |
#print(f'UNET: {pipe.unet}')
|
172 |
pipe.watermark=None
|
|
|
210 |
seed = random.randint(0, MAX_SEED)
|
211 |
return seed
|
212 |
|
213 |
+
def uploadNote():
|
214 |
+
with open(filename, "w") as f:
|
215 |
+
f.write(f"Realvis 5.0 (Tester A): {seed} png\n")
|
216 |
+
f.write(f"Date/time: {timestamp} \n")
|
217 |
+
f.write(f"Prompt: {prompt} \n")
|
218 |
+
f.write(f"Steps: {num_inference_steps} \n")
|
219 |
+
f.write(f"Guidance Scale: {guidance_scale} \n")
|
220 |
+
f.write(f"SPACE SETUP: \n")
|
221 |
+
f.write(f"Use Model Dtype: no \n")
|
222 |
+
f.write(f"Model Scheduler: Euler_a custom before cuda \n")
|
223 |
+
f.write(f"Model VAE: default SG161222/RealVisXL_V5.0 \n")
|
224 |
+
f.write(f"Model UNET: default SG161222/RealVisXL_V5.0 \n")
|
225 |
+
upload_to_ftp(filename)
|
226 |
+
|
227 |
@spaces.GPU(duration=30)
|
228 |
def generate_30(
|
229 |
model_choice: str,
|
|
|
267 |
# write note txt
|
268 |
filename= f'tst_{seed}.txt'
|
269 |
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
|
270 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
271 |
for i in range(0, num_images, BATCH_SIZE):
|
272 |
batch_options = options.copy()
|
273 |
batch_options["prompt"] = options["prompt"][i:i+BATCH_SIZE]
|
274 |
if "negative_prompt" in batch_options:
|
275 |
batch_options["negative_prompt"] = options["negative_prompt"][i:i+BATCH_SIZE]
|
276 |
images.extend(pipe(**batch_options).images)
|
277 |
+
sd_image_path = f"rv50_A_{seed}.png"
|
278 |
images[0].save(sd_image_path,optimize=False,compress_level=0)
|
279 |
upload_to_ftp(sd_image_path)
|
280 |
image_paths = [save_image(img) for img in images]
|
|
|
325 |
# write note txt
|
326 |
filename= f'tst_{seed}.txt'
|
327 |
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
|
328 |
+
uploadNote()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
329 |
for i in range(0, num_images, BATCH_SIZE):
|
330 |
batch_options = options.copy()
|
331 |
batch_options["prompt"] = options["prompt"][i:i+BATCH_SIZE]
|
332 |
if "negative_prompt" in batch_options:
|
333 |
batch_options["negative_prompt"] = options["negative_prompt"][i:i+BATCH_SIZE]
|
334 |
images.extend(pipe(**batch_options).images)
|
335 |
+
sd_image_path = f"rv50_A_{seed}.png"
|
336 |
images[0].save(sd_image_path,optimize=False,compress_level=0)
|
337 |
upload_to_ftp(sd_image_path)
|
338 |
image_paths = [save_image(img) for img in images]
|
|
|
383 |
# write note txt
|
384 |
filename= f'tst_{seed}.txt'
|
385 |
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
|
386 |
+
uploadNote()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
387 |
for i in range(0, num_images, BATCH_SIZE):
|
388 |
batch_options = options.copy()
|
389 |
batch_options["prompt"] = options["prompt"][i:i+BATCH_SIZE]
|
390 |
if "negative_prompt" in batch_options:
|
391 |
batch_options["negative_prompt"] = options["negative_prompt"][i:i+BATCH_SIZE]
|
392 |
images.extend(pipe(**batch_options).images)
|
393 |
+
sd_image_path = f"rv50_A_{seed}.png"
|
394 |
images[0].save(sd_image_path,optimize=False,compress_level=0)
|
395 |
upload_to_ftp(sd_image_path)
|
396 |
image_paths = [save_image(img) for img in images]
|