Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -238,12 +238,10 @@ def randomize_seed_fn(seed: int, randomize_seed: bool) -> int:
|
|
| 238 |
seed = random.randint(0, MAX_SEED)
|
| 239 |
return seed
|
| 240 |
|
| 241 |
-
def uploadNote():
|
| 242 |
-
|
| 243 |
-
filename= f'tst_A_{seed}.txt'
|
| 244 |
-
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
|
| 245 |
with open(filename, "w") as f:
|
| 246 |
-
f.write(f"Realvis 5.0 (Tester A)
|
| 247 |
f.write(f"Date/time: {timestamp} \n")
|
| 248 |
f.write(f"Prompt: {prompt} \n")
|
| 249 |
f.write(f"Steps: {num_inference_steps} \n")
|
|
@@ -298,14 +296,15 @@ def generate_30(
|
|
| 298 |
options["use_resolution_binning"] = True
|
| 299 |
images = []
|
| 300 |
pipe.scheduler.set_timesteps(num_inference_steps,device)
|
| 301 |
-
|
|
|
|
| 302 |
for i in range(0, num_images, BATCH_SIZE):
|
| 303 |
batch_options = options.copy()
|
| 304 |
batch_options["prompt"] = options["prompt"][i:i+BATCH_SIZE]
|
| 305 |
if "negative_prompt" in batch_options:
|
| 306 |
batch_options["negative_prompt"] = options["negative_prompt"][i:i+BATCH_SIZE]
|
| 307 |
images.extend(pipe(**batch_options).images)
|
| 308 |
-
sd_image_path = f"rv50_A_{
|
| 309 |
images[0].save(sd_image_path,optimize=False,compress_level=0)
|
| 310 |
upload_to_ftp(sd_image_path)
|
| 311 |
image_paths = [save_image(img) for img in images]
|
|
@@ -353,7 +352,8 @@ def generate_60(
|
|
| 353 |
options["use_resolution_binning"] = True
|
| 354 |
images = []
|
| 355 |
pipe.scheduler.set_timesteps(num_inference_steps,device)
|
| 356 |
-
|
|
|
|
| 357 |
for i in range(0, num_images, BATCH_SIZE):
|
| 358 |
batch_options = options.copy()
|
| 359 |
batch_options["prompt"] = options["prompt"][i:i+BATCH_SIZE]
|
|
@@ -408,7 +408,8 @@ def generate_90(
|
|
| 408 |
options["use_resolution_binning"] = True
|
| 409 |
images = []
|
| 410 |
pipe.scheduler.set_timesteps(num_inference_steps,device)
|
| 411 |
-
|
|
|
|
| 412 |
for i in range(0, num_images, BATCH_SIZE):
|
| 413 |
batch_options = options.copy()
|
| 414 |
batch_options["prompt"] = options["prompt"][i:i+BATCH_SIZE]
|
|
|
|
| 238 |
seed = random.randint(0, MAX_SEED)
|
| 239 |
return seed
|
| 240 |
|
| 241 |
+
def uploadNote(prompt,num_inference_steps,guidance_scale,timestamp):
|
| 242 |
+
filename= f'tst_A_{timestamp}.txt'
|
|
|
|
|
|
|
| 243 |
with open(filename, "w") as f:
|
| 244 |
+
f.write(f"Realvis 5.0 (Tester A) \n")
|
| 245 |
f.write(f"Date/time: {timestamp} \n")
|
| 246 |
f.write(f"Prompt: {prompt} \n")
|
| 247 |
f.write(f"Steps: {num_inference_steps} \n")
|
|
|
|
| 296 |
options["use_resolution_binning"] = True
|
| 297 |
images = []
|
| 298 |
pipe.scheduler.set_timesteps(num_inference_steps,device)
|
| 299 |
+
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
|
| 300 |
+
uploadNote(prompt,num_inference_steps,guidance_scale,timestamp)
|
| 301 |
for i in range(0, num_images, BATCH_SIZE):
|
| 302 |
batch_options = options.copy()
|
| 303 |
batch_options["prompt"] = options["prompt"][i:i+BATCH_SIZE]
|
| 304 |
if "negative_prompt" in batch_options:
|
| 305 |
batch_options["negative_prompt"] = options["negative_prompt"][i:i+BATCH_SIZE]
|
| 306 |
images.extend(pipe(**batch_options).images)
|
| 307 |
+
sd_image_path = f"rv50_A_{timestamp}.png"
|
| 308 |
images[0].save(sd_image_path,optimize=False,compress_level=0)
|
| 309 |
upload_to_ftp(sd_image_path)
|
| 310 |
image_paths = [save_image(img) for img in images]
|
|
|
|
| 352 |
options["use_resolution_binning"] = True
|
| 353 |
images = []
|
| 354 |
pipe.scheduler.set_timesteps(num_inference_steps,device)
|
| 355 |
+
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
|
| 356 |
+
uploadNote(prompt,num_inference_steps,guidance_scale,timestamp)
|
| 357 |
for i in range(0, num_images, BATCH_SIZE):
|
| 358 |
batch_options = options.copy()
|
| 359 |
batch_options["prompt"] = options["prompt"][i:i+BATCH_SIZE]
|
|
|
|
| 408 |
options["use_resolution_binning"] = True
|
| 409 |
images = []
|
| 410 |
pipe.scheduler.set_timesteps(num_inference_steps,device)
|
| 411 |
+
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
|
| 412 |
+
uploadNote(prompt,num_inference_steps,guidance_scale,timestamp)
|
| 413 |
for i in range(0, num_images, BATCH_SIZE):
|
| 414 |
batch_options = options.copy()
|
| 415 |
batch_options["prompt"] = options["prompt"][i:i+BATCH_SIZE]
|