Update app.py
Browse files
app.py
CHANGED
@@ -4,7 +4,6 @@ from flask import Flask, request, send_file
|
|
4 |
from io import BytesIO
|
5 |
from PIL import Image, ImageChops
|
6 |
from diffusers import DiffusionPipeline
|
7 |
-
from all_models import models # Import the models variable from all_models
|
8 |
|
9 |
app = Flask(__name__)
|
10 |
|
@@ -15,8 +14,10 @@ def load_model(model_name):
|
|
15 |
global models_load
|
16 |
if model_name not in models_load:
|
17 |
try:
|
|
|
|
|
18 |
# モデルのロード
|
19 |
-
models_load[model_name] = DiffusionPipeline.from_pretrained(models
|
20 |
except Exception as error:
|
21 |
print(f"Error loading model {model_name}: {error}")
|
22 |
models_load[model_name] = None
|
|
|
4 |
from io import BytesIO
|
5 |
from PIL import Image, ImageChops
|
6 |
from diffusers import DiffusionPipeline
|
|
|
7 |
|
8 |
app = Flask(__name__)
|
9 |
|
|
|
14 |
global models_load
|
15 |
if model_name not in models_load:
|
16 |
try:
|
17 |
+
# ディレクトリ内のファイルリストを出力
|
18 |
+
print("Available models:", os.listdir('models'))
|
19 |
# モデルのロード
|
20 |
+
models_load[model_name] = DiffusionPipeline.from_pretrained(f'models/{model_name}')
|
21 |
except Exception as error:
|
22 |
print(f"Error loading model {model_name}: {error}")
|
23 |
models_load[model_name] = None
|