Commit
·
e7cf985
1
Parent(s):
26c29b6
added output path to config
Browse files- gradio_server.py +11 -2
gradio_server.py
CHANGED
|
@@ -269,6 +269,7 @@ if not Path(server_config_filename).is_file():
|
|
| 269 |
"transformer_filename": transformer_choices_t2v[0],
|
| 270 |
"transformer_filename_i2v": transformer_choices_i2v[1], ########
|
| 271 |
"text_encoder_filename" : text_encoder_choices[1],
|
|
|
|
| 272 |
"compile" : "",
|
| 273 |
"default_ui": "t2v",
|
| 274 |
"boost" : 1,
|
|
@@ -643,6 +644,7 @@ def apply_changes( state,
|
|
| 643 |
transformer_t2v_choice,
|
| 644 |
transformer_i2v_choice,
|
| 645 |
text_encoder_choice,
|
|
|
|
| 646 |
attention_choice,
|
| 647 |
compile_choice,
|
| 648 |
profile_choice,
|
|
@@ -660,6 +662,7 @@ def apply_changes( state,
|
|
| 660 |
"transformer_filename": transformer_choices_t2v[transformer_t2v_choice],
|
| 661 |
"transformer_filename_i2v": transformer_choices_i2v[transformer_i2v_choice], ##########
|
| 662 |
"text_encoder_filename" : text_encoder_choices[text_encoder_choice],
|
|
|
|
| 663 |
"compile" : compile_choice,
|
| 664 |
"profile" : profile_choice,
|
| 665 |
"vae_config" : vae_config_choice,
|
|
@@ -1088,7 +1091,8 @@ def generate_video(
|
|
| 1088 |
|
| 1089 |
file_list = []
|
| 1090 |
state["file_list"] = file_list
|
| 1091 |
-
save_path
|
|
|
|
| 1092 |
os.makedirs(save_path, exist_ok=True)
|
| 1093 |
video_no = 0
|
| 1094 |
total_video = repeat_generation * len(prompts)
|
|
@@ -1229,7 +1233,7 @@ def generate_video(
|
|
| 1229 |
file_name = f"{time_flag}_seed{seed}_{sanitize_file_name(prompt[:50]).strip()}.mp4"
|
| 1230 |
else:
|
| 1231 |
file_name = f"{time_flag}_seed{seed}_{sanitize_file_name(prompt[:100]).strip()}.mp4"
|
| 1232 |
-
video_path = os.path.join(
|
| 1233 |
cache_video(
|
| 1234 |
tensor=sample[None],
|
| 1235 |
save_file=video_path,
|
|
@@ -1675,6 +1679,10 @@ def create_demo():
|
|
| 1675 |
value= index,
|
| 1676 |
label="Text Encoder model"
|
| 1677 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1678 |
def check(mode):
|
| 1679 |
if not mode in attention_modes_supported:
|
| 1680 |
return " (NOT INSTALLED)"
|
|
@@ -2030,6 +2038,7 @@ def create_demo():
|
|
| 2030 |
transformer_t2v_choice,
|
| 2031 |
transformer_i2v_choice,
|
| 2032 |
text_encoder_choice,
|
|
|
|
| 2033 |
attention_choice,
|
| 2034 |
compile_choice,
|
| 2035 |
profile_choice,
|
|
|
|
| 269 |
"transformer_filename": transformer_choices_t2v[0],
|
| 270 |
"transformer_filename_i2v": transformer_choices_i2v[1], ########
|
| 271 |
"text_encoder_filename" : text_encoder_choices[1],
|
| 272 |
+
"save_path": os.path.join(os.getcwd(), "gradio_outputs"),
|
| 273 |
"compile" : "",
|
| 274 |
"default_ui": "t2v",
|
| 275 |
"boost" : 1,
|
|
|
|
| 644 |
transformer_t2v_choice,
|
| 645 |
transformer_i2v_choice,
|
| 646 |
text_encoder_choice,
|
| 647 |
+
save_path_choice,
|
| 648 |
attention_choice,
|
| 649 |
compile_choice,
|
| 650 |
profile_choice,
|
|
|
|
| 662 |
"transformer_filename": transformer_choices_t2v[transformer_t2v_choice],
|
| 663 |
"transformer_filename_i2v": transformer_choices_i2v[transformer_i2v_choice], ##########
|
| 664 |
"text_encoder_filename" : text_encoder_choices[text_encoder_choice],
|
| 665 |
+
"save_path" : save_path_choice,
|
| 666 |
"compile" : compile_choice,
|
| 667 |
"profile" : profile_choice,
|
| 668 |
"vae_config" : vae_config_choice,
|
|
|
|
| 1091 |
|
| 1092 |
file_list = []
|
| 1093 |
state["file_list"] = file_list
|
| 1094 |
+
global save_path
|
| 1095 |
+
save_path = server_config.get("save_path", os.path.join(os.getcwd(), "gradio_outputs"))
|
| 1096 |
os.makedirs(save_path, exist_ok=True)
|
| 1097 |
video_no = 0
|
| 1098 |
total_video = repeat_generation * len(prompts)
|
|
|
|
| 1233 |
file_name = f"{time_flag}_seed{seed}_{sanitize_file_name(prompt[:50]).strip()}.mp4"
|
| 1234 |
else:
|
| 1235 |
file_name = f"{time_flag}_seed{seed}_{sanitize_file_name(prompt[:100]).strip()}.mp4"
|
| 1236 |
+
video_path = os.path.join(save_path, file_name)
|
| 1237 |
cache_video(
|
| 1238 |
tensor=sample[None],
|
| 1239 |
save_file=video_path,
|
|
|
|
| 1679 |
value= index,
|
| 1680 |
label="Text Encoder model"
|
| 1681 |
)
|
| 1682 |
+
save_path_choice = gr.Textbox(
|
| 1683 |
+
label="Output Folder for Generated Videos",
|
| 1684 |
+
value=server_config.get("save_path", os.path.join(os.getcwd(), "gradio_outputs"))
|
| 1685 |
+
)
|
| 1686 |
def check(mode):
|
| 1687 |
if not mode in attention_modes_supported:
|
| 1688 |
return " (NOT INSTALLED)"
|
|
|
|
| 2038 |
transformer_t2v_choice,
|
| 2039 |
transformer_i2v_choice,
|
| 2040 |
text_encoder_choice,
|
| 2041 |
+
save_path_choice,
|
| 2042 |
attention_choice,
|
| 2043 |
compile_choice,
|
| 2044 |
profile_choice,
|