Update app.py
Browse files
app.py
CHANGED
@@ -22,6 +22,7 @@ def load_model(model_name):
|
|
22 |
if model_name not in models_load:
|
23 |
try:
|
24 |
m = gr.load(f'models/{model_name}')
|
|
|
25 |
models_load[model_name] = m
|
26 |
except Exception as error:
|
27 |
print(f"Error loading model {model_name}: {error}")
|
@@ -54,6 +55,9 @@ def gen_fn(model_str, prompt, negative_prompt=None, noise=None, cfg_scale=None,
|
|
54 |
# モデル呼び出し
|
55 |
result = models_load[model_str](*inputs)
|
56 |
|
|
|
|
|
|
|
57 |
# Check if result is an image or a file path
|
58 |
if isinstance(result, str): # Assuming result might be a file path
|
59 |
if os.path.exists(result):
|
@@ -65,7 +69,7 @@ def gen_fn(model_str, prompt, negative_prompt=None, noise=None, cfg_scale=None,
|
|
65 |
image = result
|
66 |
else:
|
67 |
print("Result is not an image:", type(result))
|
68 |
-
return None,
|
69 |
|
70 |
# Check if the image is completely black
|
71 |
black = Image.new('RGB', image.size, (0, 0, 0))
|
|
|
22 |
if model_name not in models_load:
|
23 |
try:
|
24 |
m = gr.load(f'models/{model_name}')
|
25 |
+
print(f"Model {model_name} loaded successfully.")
|
26 |
models_load[model_name] = m
|
27 |
except Exception as error:
|
28 |
print(f"Error loading model {model_name}: {error}")
|
|
|
55 |
# モデル呼び出し
|
56 |
result = models_load[model_str](*inputs)
|
57 |
|
58 |
+
# Debugging result type
|
59 |
+
print(f"Result type: {type(result)}, Result: {result}")
|
60 |
+
|
61 |
# Check if result is an image or a file path
|
62 |
if isinstance(result, str): # Assuming result might be a file path
|
63 |
if os.path.exists(result):
|
|
|
69 |
image = result
|
70 |
else:
|
71 |
print("Result is not an image:", type(result))
|
72 |
+
return None, f"Unexpected result type: {type(result)}"
|
73 |
|
74 |
# Check if the image is completely black
|
75 |
black = Image.new('RGB', image.size, (0, 0, 0))
|