MCPcopy Create free account
hub / github.com/Sygil-Dev/sygil-webui / flag

Method flag

scripts/webui.py:2314–2400  ·  view source on GitHub ↗
(self, flag_data, flag_option=None, flag_index=None, username=None)

Source from the content-addressed store, hash-verified

2312 pass
2313
2314 def flag(self, flag_data, flag_option=None, flag_index=None, username=None):
2315 import csv
2316
2317 os.makedirs("log/images", exist_ok=True)
2318
2319 # those must match the "txt2img" function !! + images, seed, comment, stats !! NOTE: changes to UI output must be reflected here too
2320 (
2321 prompt,
2322 ddim_steps,
2323 sampler_name,
2324 toggles,
2325 ddim_eta,
2326 n_iter,
2327 batch_size,
2328 cfg_scale,
2329 seed,
2330 height,
2331 width,
2332 fp,
2333 variant_amount,
2334 variant_seed,
2335 images,
2336 seed,
2337 comment,
2338 stats,
2339 ) = flag_data
2340
2341 filenames = []
2342
2343 with open("log/log.csv", "a", encoding="utf8", newline="") as file:
2344 import time
2345 import base64
2346
2347 at_start = file.tell() == 0
2348 writer = csv.writer(file)
2349 if at_start:
2350 writer.writerow(["sep=,"])
2351 writer.writerow(
2352 [
2353 "prompt",
2354 "seed",
2355 "width",
2356 "height",
2357 "sampler",
2358 "toggles",
2359 "n_iter",
2360 "n_samples",
2361 "cfg_scale",
2362 "steps",
2363 "filename",
2364 ]
2365 )
2366
2367 filename_base = str(int(time.time() * 1000))
2368 for i, filedata in enumerate(images):
2369 filename = (
2370 "log/images/"
2371 + filename_base

Callers

nothing calls this directly

Calls 1

encodeMethod · 0.45

Tested by

no test coverage detected