Spaces:
Running
on
Zero
Running
on
Zero
vinesmsuic
commited on
Commit
•
525eef9
1
Parent(s):
8565ca9
load all image models
Browse files- app.py +2 -2
- model/pre_download.py +4 -4
app.py
CHANGED
@@ -7,7 +7,7 @@ from serve.leaderboard import build_leaderboard_tab
|
|
7 |
from model.model_manager import ModelManager
|
8 |
from pathlib import Path
|
9 |
from serve.constants import SERVER_PORT, ROOT_PATH, ELO_RESULTS_DIR
|
10 |
-
from model.pre_download import
|
11 |
|
12 |
def build_combine_demo(models, elo_results_file, leaderboard_table_file):
|
13 |
|
@@ -99,7 +99,7 @@ if __name__ == "__main__":
|
|
99 |
elo_results_dir = ELO_RESULTS_DIR
|
100 |
models = ModelManager()
|
101 |
|
102 |
-
|
103 |
|
104 |
elo_results_file, leaderboard_table_file = load_elo_results(elo_results_dir)
|
105 |
demo = build_combine_demo(models, elo_results_file, leaderboard_table_file)
|
|
|
7 |
from model.model_manager import ModelManager
|
8 |
from pathlib import Path
|
9 |
from serve.constants import SERVER_PORT, ROOT_PATH, ELO_RESULTS_DIR
|
10 |
+
from model.pre_download import pre_download_all_image_models
|
11 |
|
12 |
def build_combine_demo(models, elo_results_file, leaderboard_table_file):
|
13 |
|
|
|
99 |
elo_results_dir = ELO_RESULTS_DIR
|
100 |
models = ModelManager()
|
101 |
|
102 |
+
pre_download_all_image_models()
|
103 |
|
104 |
elo_results_file, leaderboard_table_file = load_elo_results(elo_results_dir)
|
105 |
demo = build_combine_demo(models, elo_results_file, leaderboard_table_file)
|
model/pre_download.py
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
from .models import IMAGE_GENERATION_MODELS, IMAGE_EDITION_MODELS, VIDEO_GENERATION_MODELS
|
2 |
|
3 |
-
def
|
4 |
"""
|
5 |
-
Pre-download all models to avoid download delay during the first user request
|
6 |
"""
|
7 |
imagen_dl_error = pre_download_image_models()
|
8 |
imagedit_dl_error = pre_download_image_models()
|
9 |
-
videogen_dl_error = pre_download_video_models()
|
10 |
print("All models downloaded.")
|
11 |
-
print("Models that encountered download error:", "Image Generation:", imagen_dl_error, "Image Edition:", imagedit_dl_error
|
12 |
|
13 |
def pre_download_image_models():
|
14 |
"""
|
|
|
1 |
from .models import IMAGE_GENERATION_MODELS, IMAGE_EDITION_MODELS, VIDEO_GENERATION_MODELS
|
2 |
|
3 |
+
def pre_download_all_image_models():
|
4 |
"""
|
5 |
+
Pre-download all image models to avoid download delay during the first user request
|
6 |
"""
|
7 |
imagen_dl_error = pre_download_image_models()
|
8 |
imagedit_dl_error = pre_download_image_models()
|
9 |
+
#videogen_dl_error = pre_download_video_models()
|
10 |
print("All models downloaded.")
|
11 |
+
print("Models that encountered download error:", "Image Generation:", imagen_dl_error, "Image Edition:", imagedit_dl_error)#, "Video Generation:", videogen_dl_error)
|
12 |
|
13 |
def pre_download_image_models():
|
14 |
"""
|