Spaces:
Running
Running
ZhangYuhan
commited on
Commit
•
25646a8
1
Parent(s):
9ff2a5b
update serve
Browse files- serve/gradio_web_i2s.py +29 -0
- serve/gradio_web_t2s.py +29 -0
- serve/inference.py +24 -20
serve/gradio_web_i2s.py
CHANGED
@@ -437,12 +437,29 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
437 |
None,
|
438 |
states + [imagebox] + results,
|
439 |
api_name="model_selector_left"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
440 |
)
|
|
|
441 |
model_selector_right.change(
|
442 |
clear_i2s_history_side_by_side,
|
443 |
None,
|
444 |
states + [imagebox] + results,
|
445 |
api_name="model_selector_right"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
446 |
)
|
447 |
|
448 |
for dim_md, btn_list in zip(dim_md_list, [geo_btn_list, text_btn_list, align_btn_list, plausive_btn_list, coherence_btn_list]):
|
@@ -662,6 +679,18 @@ def build_i2s_ui_single_model(models):
|
|
662 |
[state] + btn_list
|
663 |
)
|
664 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
665 |
sample_btn.click(
|
666 |
sample_image,
|
667 |
[state, model_selector],
|
|
|
437 |
None,
|
438 |
states + [imagebox] + results,
|
439 |
api_name="model_selector_left"
|
440 |
+
).then(
|
441 |
+
disable_mds,
|
442 |
+
None,
|
443 |
+
dim_md_list
|
444 |
+
).then(
|
445 |
+
disable_buttons_side_by_side,
|
446 |
+
None,
|
447 |
+
vote_btn_list + [regenerate_btn, clear_btn]
|
448 |
)
|
449 |
+
|
450 |
model_selector_right.change(
|
451 |
clear_i2s_history_side_by_side,
|
452 |
None,
|
453 |
states + [imagebox] + results,
|
454 |
api_name="model_selector_right"
|
455 |
+
).then(
|
456 |
+
disable_mds,
|
457 |
+
None,
|
458 |
+
dim_md_list
|
459 |
+
).then(
|
460 |
+
disable_buttons_side_by_side,
|
461 |
+
None,
|
462 |
+
vote_btn_list + [regenerate_btn, clear_btn]
|
463 |
)
|
464 |
|
465 |
for dim_md, btn_list in zip(dim_md_list, [geo_btn_list, text_btn_list, align_btn_list, plausive_btn_list, coherence_btn_list]):
|
|
|
679 |
[state] + btn_list
|
680 |
)
|
681 |
|
682 |
+
model_selector.change(
|
683 |
+
clear_i2s_history,
|
684 |
+
None,
|
685 |
+
[state, imagebox, normal, rgb],
|
686 |
+
api_name="clear_history_single",
|
687 |
+
show_progress="full"
|
688 |
+
).then(
|
689 |
+
disable_buttons,
|
690 |
+
None,
|
691 |
+
vote_btn_list + [regenerate_btn, clear_btn]
|
692 |
+
)
|
693 |
+
|
694 |
sample_btn.click(
|
695 |
sample_image,
|
696 |
[state, model_selector],
|
serve/gradio_web_t2s.py
CHANGED
@@ -435,12 +435,29 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
435 |
None,
|
436 |
states + [textbox] + results,
|
437 |
api_name="model_selector_left"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
438 |
)
|
|
|
439 |
model_selector_right.change(
|
440 |
clear_t2s_history_side_by_side,
|
441 |
None,
|
442 |
states + [textbox] + results,
|
443 |
api_name="model_selector_right"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
444 |
)
|
445 |
|
446 |
for dim_md, btn_list in zip(dim_md_list, [geo_btn_list, text_btn_list, align_btn_list, plausive_btn_list, coherence_btn_list]):
|
@@ -659,6 +676,18 @@ def build_t2s_ui_single_model(models):
|
|
659 |
[state] + btn_list
|
660 |
)
|
661 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
662 |
sample_btn.click(
|
663 |
sample_prompt,
|
664 |
[state, model_selector],
|
|
|
435 |
None,
|
436 |
states + [textbox] + results,
|
437 |
api_name="model_selector_left"
|
438 |
+
).then(
|
439 |
+
disable_mds,
|
440 |
+
None,
|
441 |
+
dim_md_list
|
442 |
+
).then(
|
443 |
+
disable_buttons_side_by_side,
|
444 |
+
None,
|
445 |
+
vote_btn_list + [regenerate_btn, clear_btn]
|
446 |
)
|
447 |
+
|
448 |
model_selector_right.change(
|
449 |
clear_t2s_history_side_by_side,
|
450 |
None,
|
451 |
states + [textbox] + results,
|
452 |
api_name="model_selector_right"
|
453 |
+
).then(
|
454 |
+
disable_mds,
|
455 |
+
None,
|
456 |
+
dim_md_list
|
457 |
+
).then(
|
458 |
+
disable_buttons_side_by_side,
|
459 |
+
None,
|
460 |
+
vote_btn_list + [regenerate_btn, clear_btn]
|
461 |
)
|
462 |
|
463 |
for dim_md, btn_list in zip(dim_md_list, [geo_btn_list, text_btn_list, align_btn_list, plausive_btn_list, coherence_btn_list]):
|
|
|
676 |
[state] + btn_list
|
677 |
)
|
678 |
|
679 |
+
model_selector.change(
|
680 |
+
clear_t2s_history,
|
681 |
+
None,
|
682 |
+
[state, textbox, normal, rgb],
|
683 |
+
api_name="clear_history_single",
|
684 |
+
show_progress="full"
|
685 |
+
).then(
|
686 |
+
disable_buttons,
|
687 |
+
None,
|
688 |
+
vote_btn_list + [regenerate_btn, clear_btn]
|
689 |
+
)
|
690 |
+
|
691 |
sample_btn.click(
|
692 |
sample_prompt,
|
693 |
[state, model_selector],
|
serve/inference.py
CHANGED
@@ -104,6 +104,7 @@ def sample_prompt(state, model_name):
|
|
104 |
|
105 |
state.model_name = model_name
|
106 |
state.prompt = prompt
|
|
|
107 |
state.offline = True,
|
108 |
state.offline_idx = idx
|
109 |
return state, prompt
|
@@ -117,6 +118,7 @@ def sample_prompt_side_by_side(state_0, state_1, model_name_0, model_name_1):
|
|
117 |
idx = random.randint(0, len(prompt_list)-1)
|
118 |
prompt = prompt_list[idx]
|
119 |
|
|
|
120 |
state_0.offline, state_1.offline = True, True
|
121 |
state_0.offline_idx, state_1.offline_idx = idx, idx
|
122 |
state_0.prompt, state_1.prompt = prompt, prompt
|
@@ -131,6 +133,7 @@ def sample_image(state, model_name):
|
|
131 |
|
132 |
state.model_name = model_name
|
133 |
state.image = img_url
|
|
|
134 |
state.offline = True,
|
135 |
state.offline_idx = idx
|
136 |
return state, img_url
|
@@ -145,6 +148,7 @@ def sample_image_side_by_side(state_0, state_1, model_name_0, model_name_1):
|
|
145 |
idx = random.sample(image_list.keys(), 1)[0]
|
146 |
img_url = image_list[idx]
|
147 |
|
|
|
148 |
state_0.offline, state_1.offline = True, True
|
149 |
state_0.offline_idx, state_1.offline_idx = idx, idx
|
150 |
state_0.image, state_1.image = img_url, img_url
|
@@ -192,13 +196,13 @@ def generate_t2s(gen_func, render_func,
|
|
192 |
# logger.info(f"===output===: {output}")
|
193 |
data = {
|
194 |
"tstamp": round(finish_tstamp, 4),
|
195 |
-
"ip": get_ip(request),
|
196 |
"model": model_name,
|
197 |
"type": "offline",
|
198 |
"gen_params": {},
|
199 |
"state": state.dict(),
|
200 |
"start": round(start_time, 4),
|
201 |
"finish": round(finish_tstamp, 4),
|
|
|
202 |
}
|
203 |
else:
|
204 |
start_time = time.time()
|
@@ -217,7 +221,6 @@ def generate_t2s(gen_func, render_func,
|
|
217 |
# logger.info(f"===output===: {output}")
|
218 |
data = {
|
219 |
"tstamp": round(finish_tstamp, 4),
|
220 |
-
"ip": get_ip(request),
|
221 |
"model": model_name,
|
222 |
"type": "online",
|
223 |
"gen_params": {},
|
@@ -227,6 +230,7 @@ def generate_t2s(gen_func, render_func,
|
|
227 |
"time": round(finish_time - start_time, 4),
|
228 |
"generate_time": round(generate_time, 4),
|
229 |
"render_time": round(render_time, 4),
|
|
|
230 |
}
|
231 |
|
232 |
with open(get_conv_log_filename(), "a") as fout:
|
@@ -287,23 +291,23 @@ def generate_t2s_multi(gen_func, render_func,
|
|
287 |
# logger.info(f"===output===: {output}")
|
288 |
data_0 = {
|
289 |
"tstamp": round(finish_tstamp, 4),
|
290 |
-
"ip": get_ip(request),
|
291 |
"model": model_name_0,
|
292 |
"type": "offline",
|
293 |
"gen_params": {},
|
294 |
"state": state_0.dict(),
|
295 |
"start": round(start_time, 4),
|
296 |
"finish": round(finish_tstamp, 4),
|
|
|
297 |
}
|
298 |
data_1 = {
|
299 |
"tstamp": round(finish_tstamp, 4),
|
300 |
-
"ip": get_ip(request),
|
301 |
"model": model_name_1,
|
302 |
"type": "offline",
|
303 |
"gen_params": {},
|
304 |
"state": state_1.dict(),
|
305 |
"start": round(start_time, 4),
|
306 |
"finish": round(finish_tstamp, 4),
|
|
|
307 |
}
|
308 |
else:
|
309 |
start_time = time.time()
|
@@ -322,7 +326,6 @@ def generate_t2s_multi(gen_func, render_func,
|
|
322 |
# logger.info(f"===output===: {output}")
|
323 |
data_0 = {
|
324 |
"tstamp": round(finish_tstamp, 4),
|
325 |
-
"ip": get_ip(request),
|
326 |
"model": model_name_0,
|
327 |
"type": "online",
|
328 |
"gen_params": {},
|
@@ -332,10 +335,10 @@ def generate_t2s_multi(gen_func, render_func,
|
|
332 |
"time": round(finish_time - start_time, 4),
|
333 |
"generate_time": round(generate_time, 4),
|
334 |
"render_time": round(render_time, 4),
|
|
|
335 |
}
|
336 |
data_1 = {
|
337 |
"tstamp": round(finish_tstamp, 4),
|
338 |
-
"ip": get_ip(request),
|
339 |
"model": model_name_1,
|
340 |
"type": "online",
|
341 |
"gen_params": {},
|
@@ -345,6 +348,7 @@ def generate_t2s_multi(gen_func, render_func,
|
|
345 |
"time": round(finish_time - start_time, 4),
|
346 |
"generate_time": round(generate_time, 4),
|
347 |
"render_time": round(render_time, 4),
|
|
|
348 |
}
|
349 |
|
350 |
with open(get_conv_log_filename(), "a") as fout:
|
@@ -406,23 +410,23 @@ def generate_t2s_multi_annoy(gen_func, render_func,
|
|
406 |
# logger.info(f"===output===: {output}")
|
407 |
data_0 = {
|
408 |
"tstamp": round(finish_tstamp, 4),
|
409 |
-
"ip": get_ip(request),
|
410 |
"model": model_name_0,
|
411 |
"type": "offline",
|
412 |
"gen_params": {},
|
413 |
"state": state_0.dict(),
|
414 |
"start": round(start_time, 4),
|
415 |
"finish": round(finish_tstamp, 4),
|
|
|
416 |
}
|
417 |
data_1 = {
|
418 |
"tstamp": round(finish_tstamp, 4),
|
419 |
-
"ip": get_ip(request),
|
420 |
"model": model_name_1,
|
421 |
"type": "offline",
|
422 |
"gen_params": {},
|
423 |
"state": state_1.dict(),
|
424 |
"start": round(start_time, 4),
|
425 |
"finish": round(finish_tstamp, 4),
|
|
|
426 |
}
|
427 |
else:
|
428 |
start_time = time.time()
|
@@ -443,7 +447,6 @@ def generate_t2s_multi_annoy(gen_func, render_func,
|
|
443 |
# logger.info(f"===output===: {output}")
|
444 |
data_0 = {
|
445 |
"tstamp": round(finish_tstamp, 4),
|
446 |
-
"ip": get_ip(request),
|
447 |
"model": model_name_0,
|
448 |
"type": "online",
|
449 |
"gen_params": {},
|
@@ -453,10 +456,10 @@ def generate_t2s_multi_annoy(gen_func, render_func,
|
|
453 |
"time": round(finish_time - start_time, 4),
|
454 |
"generate_time": round(generate_time, 4),
|
455 |
"render_time": round(render_time, 4),
|
|
|
456 |
}
|
457 |
data_1 = {
|
458 |
"tstamp": round(finish_tstamp, 4),
|
459 |
-
"ip": get_ip(request),
|
460 |
"model": model_name_1,
|
461 |
"type": "online",
|
462 |
"gen_params": {},
|
@@ -466,6 +469,7 @@ def generate_t2s_multi_annoy(gen_func, render_func,
|
|
466 |
"time": round(finish_time - start_time, 4),
|
467 |
"generate_time": round(generate_time, 4),
|
468 |
"render_time": round(render_time, 4),
|
|
|
469 |
}
|
470 |
|
471 |
with open(get_conv_log_filename(), "a") as fout:
|
@@ -511,13 +515,13 @@ def generate_i2s(gen_func, render_func, state, image, model_name, request: gr.Re
|
|
511 |
# logger.info(f"===output===: {output}")
|
512 |
data = {
|
513 |
"tstamp": round(finish_tstamp, 4),
|
514 |
-
"ip": get_ip(request),
|
515 |
"model": model_name,
|
516 |
"type": "offline",
|
517 |
"gen_params": {},
|
518 |
"state": state.dict(),
|
519 |
"start": round(start_time, 4),
|
520 |
"finish": round(finish_tstamp, 4),
|
|
|
521 |
}
|
522 |
else:
|
523 |
start_time = time.time()
|
@@ -536,7 +540,6 @@ def generate_i2s(gen_func, render_func, state, image, model_name, request: gr.Re
|
|
536 |
# logger.info(f"===output===: {output}")
|
537 |
data = {
|
538 |
"tstamp": round(finish_tstamp, 4),
|
539 |
-
"ip": get_ip(request),
|
540 |
"model": model_name,
|
541 |
"type": "online",
|
542 |
"gen_params": {},
|
@@ -546,6 +549,7 @@ def generate_i2s(gen_func, render_func, state, image, model_name, request: gr.Re
|
|
546 |
"time": round(finish_time - start_time, 4),
|
547 |
"generate_time": round(generate_time, 4),
|
548 |
"render_time": round(render_time, 4),
|
|
|
549 |
}
|
550 |
|
551 |
with open(get_conv_log_filename(), "a") as fout:
|
@@ -603,23 +607,23 @@ def generate_i2s_multi(gen_func, render_func,
|
|
603 |
# logger.info(f"===output===: {output}")
|
604 |
data_0 = {
|
605 |
"tstamp": round(finish_tstamp, 4),
|
606 |
-
"ip": get_ip(request),
|
607 |
"model": model_name_0,
|
608 |
"type": "offline",
|
609 |
"gen_params": {},
|
610 |
"state": state_0.dict(),
|
611 |
"start": round(start_time, 4),
|
612 |
"finish": round(finish_tstamp, 4),
|
|
|
613 |
}
|
614 |
data_1 = {
|
615 |
"tstamp": round(finish_tstamp, 4),
|
616 |
-
"ip": get_ip(request),
|
617 |
"model": model_name_1,
|
618 |
"type": "offline",
|
619 |
"gen_params": {},
|
620 |
"state": state_1.dict(),
|
621 |
"start": round(start_time, 4),
|
622 |
"finish": round(finish_tstamp, 4),
|
|
|
623 |
}
|
624 |
else:
|
625 |
start_time = time.time()
|
@@ -638,7 +642,6 @@ def generate_i2s_multi(gen_func, render_func,
|
|
638 |
# logger.info(f"===output===: {output}")
|
639 |
data_0 = {
|
640 |
"tstamp": round(finish_tstamp, 4),
|
641 |
-
"ip": get_ip(request),
|
642 |
"model": model_name_0,
|
643 |
"type": "online",
|
644 |
"gen_params": {},
|
@@ -648,10 +651,10 @@ def generate_i2s_multi(gen_func, render_func,
|
|
648 |
"time": round(finish_time - start_time, 4),
|
649 |
"generate_time": round(generate_time, 4),
|
650 |
"render_time": round(render_time, 4),
|
|
|
651 |
}
|
652 |
data_1 = {
|
653 |
"tstamp": round(finish_tstamp, 4),
|
654 |
-
"ip": get_ip(request),
|
655 |
"model": model_name_1,
|
656 |
"type": "online",
|
657 |
"gen_params": {},
|
@@ -661,6 +664,7 @@ def generate_i2s_multi(gen_func, render_func,
|
|
661 |
"time": round(finish_time - start_time, 4),
|
662 |
"generate_time": round(generate_time, 4),
|
663 |
"render_time": round(render_time, 4),
|
|
|
664 |
}
|
665 |
|
666 |
with open(get_conv_log_filename(), "a") as fout:
|
@@ -718,23 +722,23 @@ def generate_i2s_multi_annoy(gen_func, render_func,
|
|
718 |
# logger.info(f"===output===: {output}")
|
719 |
data_0 = {
|
720 |
"tstamp": round(finish_tstamp, 4),
|
721 |
-
"ip": get_ip(request),
|
722 |
"model": model_name_0,
|
723 |
"type": "offline",
|
724 |
"gen_params": {},
|
725 |
"state": state_0.dict(),
|
726 |
"start": round(start_time, 4),
|
727 |
"finish": round(finish_tstamp, 4),
|
|
|
728 |
}
|
729 |
data_1 = {
|
730 |
"tstamp": round(finish_tstamp, 4),
|
731 |
-
"ip": get_ip(request),
|
732 |
"model": model_name_1,
|
733 |
"type": "offline",
|
734 |
"gen_params": {},
|
735 |
"state": state_1.dict(),
|
736 |
"start": round(start_time, 4),
|
737 |
"finish": round(finish_tstamp, 4),
|
|
|
738 |
}
|
739 |
else:
|
740 |
start_time = time.time()
|
@@ -754,7 +758,6 @@ def generate_i2s_multi_annoy(gen_func, render_func,
|
|
754 |
# logger.info(f"===output===: {output}")
|
755 |
data_0 = {
|
756 |
"tstamp": round(finish_tstamp, 4),
|
757 |
-
"ip": get_ip(request),
|
758 |
"model": model_name_0,
|
759 |
"type": "online",
|
760 |
"gen_params": {},
|
@@ -764,10 +767,10 @@ def generate_i2s_multi_annoy(gen_func, render_func,
|
|
764 |
"time": round(finish_time - start_time, 4),
|
765 |
"generate_time": round(generate_time, 4),
|
766 |
"render_time": round(render_time, 4),
|
|
|
767 |
}
|
768 |
data_1 = {
|
769 |
"tstamp": round(finish_tstamp, 4),
|
770 |
-
"ip": get_ip(request),
|
771 |
"model": model_name_1,
|
772 |
"type": "online",
|
773 |
"gen_params": {},
|
@@ -777,6 +780,7 @@ def generate_i2s_multi_annoy(gen_func, render_func,
|
|
777 |
"time": round(finish_time - start_time, 4),
|
778 |
"generate_time": round(generate_time, 4),
|
779 |
"render_time": round(render_time, 4),
|
|
|
780 |
}
|
781 |
|
782 |
with open(get_conv_log_filename(), "a") as fout:
|
|
|
104 |
|
105 |
state.model_name = model_name
|
106 |
state.prompt = prompt
|
107 |
+
state.i2s_mode = False
|
108 |
state.offline = True,
|
109 |
state.offline_idx = idx
|
110 |
return state, prompt
|
|
|
118 |
idx = random.randint(0, len(prompt_list)-1)
|
119 |
prompt = prompt_list[idx]
|
120 |
|
121 |
+
state_0.i2s_mode, state_1.i2s_mode = False, False
|
122 |
state_0.offline, state_1.offline = True, True
|
123 |
state_0.offline_idx, state_1.offline_idx = idx, idx
|
124 |
state_0.prompt, state_1.prompt = prompt, prompt
|
|
|
133 |
|
134 |
state.model_name = model_name
|
135 |
state.image = img_url
|
136 |
+
state.i2s_mode = True
|
137 |
state.offline = True,
|
138 |
state.offline_idx = idx
|
139 |
return state, img_url
|
|
|
148 |
idx = random.sample(image_list.keys(), 1)[0]
|
149 |
img_url = image_list[idx]
|
150 |
|
151 |
+
state_0.i2s_mode, state_1.i2s_mode = True, True
|
152 |
state_0.offline, state_1.offline = True, True
|
153 |
state_0.offline_idx, state_1.offline_idx = idx, idx
|
154 |
state_0.image, state_1.image = img_url, img_url
|
|
|
196 |
# logger.info(f"===output===: {output}")
|
197 |
data = {
|
198 |
"tstamp": round(finish_tstamp, 4),
|
|
|
199 |
"model": model_name,
|
200 |
"type": "offline",
|
201 |
"gen_params": {},
|
202 |
"state": state.dict(),
|
203 |
"start": round(start_time, 4),
|
204 |
"finish": round(finish_tstamp, 4),
|
205 |
+
"ip": get_ip(request),
|
206 |
}
|
207 |
else:
|
208 |
start_time = time.time()
|
|
|
221 |
# logger.info(f"===output===: {output}")
|
222 |
data = {
|
223 |
"tstamp": round(finish_tstamp, 4),
|
|
|
224 |
"model": model_name,
|
225 |
"type": "online",
|
226 |
"gen_params": {},
|
|
|
230 |
"time": round(finish_time - start_time, 4),
|
231 |
"generate_time": round(generate_time, 4),
|
232 |
"render_time": round(render_time, 4),
|
233 |
+
"ip": get_ip(request),
|
234 |
}
|
235 |
|
236 |
with open(get_conv_log_filename(), "a") as fout:
|
|
|
291 |
# logger.info(f"===output===: {output}")
|
292 |
data_0 = {
|
293 |
"tstamp": round(finish_tstamp, 4),
|
|
|
294 |
"model": model_name_0,
|
295 |
"type": "offline",
|
296 |
"gen_params": {},
|
297 |
"state": state_0.dict(),
|
298 |
"start": round(start_time, 4),
|
299 |
"finish": round(finish_tstamp, 4),
|
300 |
+
"ip": get_ip(request),
|
301 |
}
|
302 |
data_1 = {
|
303 |
"tstamp": round(finish_tstamp, 4),
|
|
|
304 |
"model": model_name_1,
|
305 |
"type": "offline",
|
306 |
"gen_params": {},
|
307 |
"state": state_1.dict(),
|
308 |
"start": round(start_time, 4),
|
309 |
"finish": round(finish_tstamp, 4),
|
310 |
+
"ip": get_ip(request),
|
311 |
}
|
312 |
else:
|
313 |
start_time = time.time()
|
|
|
326 |
# logger.info(f"===output===: {output}")
|
327 |
data_0 = {
|
328 |
"tstamp": round(finish_tstamp, 4),
|
|
|
329 |
"model": model_name_0,
|
330 |
"type": "online",
|
331 |
"gen_params": {},
|
|
|
335 |
"time": round(finish_time - start_time, 4),
|
336 |
"generate_time": round(generate_time, 4),
|
337 |
"render_time": round(render_time, 4),
|
338 |
+
"ip": get_ip(request),
|
339 |
}
|
340 |
data_1 = {
|
341 |
"tstamp": round(finish_tstamp, 4),
|
|
|
342 |
"model": model_name_1,
|
343 |
"type": "online",
|
344 |
"gen_params": {},
|
|
|
348 |
"time": round(finish_time - start_time, 4),
|
349 |
"generate_time": round(generate_time, 4),
|
350 |
"render_time": round(render_time, 4),
|
351 |
+
"ip": get_ip(request),
|
352 |
}
|
353 |
|
354 |
with open(get_conv_log_filename(), "a") as fout:
|
|
|
410 |
# logger.info(f"===output===: {output}")
|
411 |
data_0 = {
|
412 |
"tstamp": round(finish_tstamp, 4),
|
|
|
413 |
"model": model_name_0,
|
414 |
"type": "offline",
|
415 |
"gen_params": {},
|
416 |
"state": state_0.dict(),
|
417 |
"start": round(start_time, 4),
|
418 |
"finish": round(finish_tstamp, 4),
|
419 |
+
"ip": get_ip(request),
|
420 |
}
|
421 |
data_1 = {
|
422 |
"tstamp": round(finish_tstamp, 4),
|
|
|
423 |
"model": model_name_1,
|
424 |
"type": "offline",
|
425 |
"gen_params": {},
|
426 |
"state": state_1.dict(),
|
427 |
"start": round(start_time, 4),
|
428 |
"finish": round(finish_tstamp, 4),
|
429 |
+
"ip": get_ip(request),
|
430 |
}
|
431 |
else:
|
432 |
start_time = time.time()
|
|
|
447 |
# logger.info(f"===output===: {output}")
|
448 |
data_0 = {
|
449 |
"tstamp": round(finish_tstamp, 4),
|
|
|
450 |
"model": model_name_0,
|
451 |
"type": "online",
|
452 |
"gen_params": {},
|
|
|
456 |
"time": round(finish_time - start_time, 4),
|
457 |
"generate_time": round(generate_time, 4),
|
458 |
"render_time": round(render_time, 4),
|
459 |
+
"ip": get_ip(request),
|
460 |
}
|
461 |
data_1 = {
|
462 |
"tstamp": round(finish_tstamp, 4),
|
|
|
463 |
"model": model_name_1,
|
464 |
"type": "online",
|
465 |
"gen_params": {},
|
|
|
469 |
"time": round(finish_time - start_time, 4),
|
470 |
"generate_time": round(generate_time, 4),
|
471 |
"render_time": round(render_time, 4),
|
472 |
+
"ip": get_ip(request),
|
473 |
}
|
474 |
|
475 |
with open(get_conv_log_filename(), "a") as fout:
|
|
|
515 |
# logger.info(f"===output===: {output}")
|
516 |
data = {
|
517 |
"tstamp": round(finish_tstamp, 4),
|
|
|
518 |
"model": model_name,
|
519 |
"type": "offline",
|
520 |
"gen_params": {},
|
521 |
"state": state.dict(),
|
522 |
"start": round(start_time, 4),
|
523 |
"finish": round(finish_tstamp, 4),
|
524 |
+
"ip": get_ip(request),
|
525 |
}
|
526 |
else:
|
527 |
start_time = time.time()
|
|
|
540 |
# logger.info(f"===output===: {output}")
|
541 |
data = {
|
542 |
"tstamp": round(finish_tstamp, 4),
|
|
|
543 |
"model": model_name,
|
544 |
"type": "online",
|
545 |
"gen_params": {},
|
|
|
549 |
"time": round(finish_time - start_time, 4),
|
550 |
"generate_time": round(generate_time, 4),
|
551 |
"render_time": round(render_time, 4),
|
552 |
+
"ip": get_ip(request),
|
553 |
}
|
554 |
|
555 |
with open(get_conv_log_filename(), "a") as fout:
|
|
|
607 |
# logger.info(f"===output===: {output}")
|
608 |
data_0 = {
|
609 |
"tstamp": round(finish_tstamp, 4),
|
|
|
610 |
"model": model_name_0,
|
611 |
"type": "offline",
|
612 |
"gen_params": {},
|
613 |
"state": state_0.dict(),
|
614 |
"start": round(start_time, 4),
|
615 |
"finish": round(finish_tstamp, 4),
|
616 |
+
"ip": get_ip(request),
|
617 |
}
|
618 |
data_1 = {
|
619 |
"tstamp": round(finish_tstamp, 4),
|
|
|
620 |
"model": model_name_1,
|
621 |
"type": "offline",
|
622 |
"gen_params": {},
|
623 |
"state": state_1.dict(),
|
624 |
"start": round(start_time, 4),
|
625 |
"finish": round(finish_tstamp, 4),
|
626 |
+
"ip": get_ip(request),
|
627 |
}
|
628 |
else:
|
629 |
start_time = time.time()
|
|
|
642 |
# logger.info(f"===output===: {output}")
|
643 |
data_0 = {
|
644 |
"tstamp": round(finish_tstamp, 4),
|
|
|
645 |
"model": model_name_0,
|
646 |
"type": "online",
|
647 |
"gen_params": {},
|
|
|
651 |
"time": round(finish_time - start_time, 4),
|
652 |
"generate_time": round(generate_time, 4),
|
653 |
"render_time": round(render_time, 4),
|
654 |
+
"ip": get_ip(request),
|
655 |
}
|
656 |
data_1 = {
|
657 |
"tstamp": round(finish_tstamp, 4),
|
|
|
658 |
"model": model_name_1,
|
659 |
"type": "online",
|
660 |
"gen_params": {},
|
|
|
664 |
"time": round(finish_time - start_time, 4),
|
665 |
"generate_time": round(generate_time, 4),
|
666 |
"render_time": round(render_time, 4),
|
667 |
+
"ip": get_ip(request),
|
668 |
}
|
669 |
|
670 |
with open(get_conv_log_filename(), "a") as fout:
|
|
|
722 |
# logger.info(f"===output===: {output}")
|
723 |
data_0 = {
|
724 |
"tstamp": round(finish_tstamp, 4),
|
|
|
725 |
"model": model_name_0,
|
726 |
"type": "offline",
|
727 |
"gen_params": {},
|
728 |
"state": state_0.dict(),
|
729 |
"start": round(start_time, 4),
|
730 |
"finish": round(finish_tstamp, 4),
|
731 |
+
"ip": get_ip(request),
|
732 |
}
|
733 |
data_1 = {
|
734 |
"tstamp": round(finish_tstamp, 4),
|
|
|
735 |
"model": model_name_1,
|
736 |
"type": "offline",
|
737 |
"gen_params": {},
|
738 |
"state": state_1.dict(),
|
739 |
"start": round(start_time, 4),
|
740 |
"finish": round(finish_tstamp, 4),
|
741 |
+
"ip": get_ip(request),
|
742 |
}
|
743 |
else:
|
744 |
start_time = time.time()
|
|
|
758 |
# logger.info(f"===output===: {output}")
|
759 |
data_0 = {
|
760 |
"tstamp": round(finish_tstamp, 4),
|
|
|
761 |
"model": model_name_0,
|
762 |
"type": "online",
|
763 |
"gen_params": {},
|
|
|
767 |
"time": round(finish_time - start_time, 4),
|
768 |
"generate_time": round(generate_time, 4),
|
769 |
"render_time": round(render_time, 4),
|
770 |
+
"ip": get_ip(request),
|
771 |
}
|
772 |
data_1 = {
|
773 |
"tstamp": round(finish_tstamp, 4),
|
|
|
774 |
"model": model_name_1,
|
775 |
"type": "online",
|
776 |
"gen_params": {},
|
|
|
780 |
"time": round(finish_time - start_time, 4),
|
781 |
"generate_time": round(generate_time, 4),
|
782 |
"render_time": round(render_time, 4),
|
783 |
+
"ip": get_ip(request),
|
784 |
}
|
785 |
|
786 |
with open(get_conv_log_filename(), "a") as fout:
|