Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -15,11 +15,21 @@ except Exception as e:
|
|
15 |
print(f"Error initializing model: {e}")
|
16 |
inpaint_model = None
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
def process_image(prompt, image, style, upscale_factor, inpaint):
|
19 |
try:
|
20 |
-
#
|
21 |
if image is None:
|
22 |
-
|
|
|
|
|
23 |
|
24 |
print(f"Received image type: {type(image)}")
|
25 |
|
|
|
15 |
print(f"Error initializing model: {e}")
|
16 |
inpaint_model = None
|
17 |
|
18 |
+
# Load a test image
|
19 |
+
def load_test_image():
|
20 |
+
try:
|
21 |
+
return Image.open("path/to/your/test_image.png") # Replace with a valid path
|
22 |
+
except Exception as e:
|
23 |
+
print(f"Error loading test image: {e}")
|
24 |
+
return None
|
25 |
+
|
26 |
def process_image(prompt, image, style, upscale_factor, inpaint):
|
27 |
try:
|
28 |
+
# Use a test image if no image is received
|
29 |
if image is None:
|
30 |
+
image = load_test_image()
|
31 |
+
if image is None:
|
32 |
+
return None, "No image received and failed to load test image."
|
33 |
|
34 |
print(f"Received image type: {type(image)}")
|
35 |
|