ParahumanSkitter
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -67,10 +67,18 @@ def img_to_img_fn(model_str, image, prompt, negative_prompt, max_retries=10):
|
|
67 |
while retries < max_retries:
|
68 |
try:
|
69 |
noise = str(randint(0, 9999999))
|
70 |
-
if hasattr(models_load[model_str], '
|
71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
else:
|
73 |
-
|
|
|
74 |
return result
|
75 |
except Exception as e:
|
76 |
# Check for specific error messages or status codes
|
|
|
67 |
while retries < max_retries:
|
68 |
try:
|
69 |
noise = str(randint(0, 9999999))
|
70 |
+
if hasattr(models_load[model_str], 'img2img'):
|
71 |
+
# Assuming the model has an 'img2img' method
|
72 |
+
result = models_load[model_str].img2img(image=image, prompt=f'{prompt} {noise}', negative_prompt=negative_prompt)
|
73 |
+
elif hasattr(models_load[model_str], 'image_to_image'):
|
74 |
+
# Assuming the model has an 'image_to_image' method
|
75 |
+
result = models_load[model_str].image_to_image(image=image, prompt=f'{prompt} {noise}', negative_prompt=negative_prompt)
|
76 |
+
elif hasattr(models_load[model_str], 'image2image'):
|
77 |
+
# Assuming the model has an 'image2image' method
|
78 |
+
result = models_load[model_str].image2image(image=image, prompt=f'{prompt} {noise}', negative_prompt=negative_prompt)
|
79 |
else:
|
80 |
+
# Fallback to a generic method
|
81 |
+
result = models_load[model_str](image=image, prompt=f'{prompt} {noise}', negative_prompt=negative_prompt)
|
82 |
return result
|
83 |
except Exception as e:
|
84 |
# Check for specific error messages or status codes
|