Update app.py
Browse files
app.py
CHANGED
@@ -33,22 +33,24 @@ def krypton(input, history):
|
|
33 |
print(f"Input: {input}") # Debug input
|
34 |
print(f"History: {history}") # Debug history
|
35 |
|
|
|
36 |
if input["files"]:
|
37 |
-
print("Found the image
|
38 |
image_path = input["files"][-1]["path"] if isinstance(input["files"][-1], dict) else input["files"][-1]
|
39 |
print(f"Image path: {image_path}")
|
40 |
else:
|
41 |
-
image_path = None
|
42 |
for hist in history:
|
43 |
if isinstance(hist[0], tuple):
|
44 |
image_path = hist[0][0]
|
45 |
-
|
|
|
46 |
if not image_path:
|
47 |
gr.Error("You need to upload an image for Krypton to work.")
|
48 |
return
|
49 |
|
50 |
try:
|
51 |
image = Image.open(image_path)
|
|
|
52 |
print(f"Image open: {image}")
|
53 |
except Exception as e:
|
54 |
print(f"Error opening image: {e}")
|
|
|
33 |
print(f"Input: {input}") # Debug input
|
34 |
print(f"History: {history}") # Debug history
|
35 |
|
36 |
+
image_path = None
|
37 |
if input["files"]:
|
38 |
+
print("Found the image")
|
39 |
image_path = input["files"][-1]["path"] if isinstance(input["files"][-1], dict) else input["files"][-1]
|
40 |
print(f"Image path: {image_path}")
|
41 |
else:
|
|
|
42 |
for hist in history:
|
43 |
if isinstance(hist[0], tuple):
|
44 |
image_path = hist[0][0]
|
45 |
+
break
|
46 |
+
|
47 |
if not image_path:
|
48 |
gr.Error("You need to upload an image for Krypton to work.")
|
49 |
return
|
50 |
|
51 |
try:
|
52 |
image = Image.open(image_path)
|
53 |
+
image.show() # Show the image to confirm it's loaded
|
54 |
print(f"Image open: {image}")
|
55 |
except Exception as e:
|
56 |
print(f"Error opening image: {e}")
|