Spaces:
Sleeping
Sleeping
erikbeltran
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -87,16 +87,5 @@ with gr.Blocks() as app:
|
|
87 |
outputs=[output_image, output_hash]
|
88 |
)
|
89 |
|
90 |
-
# Gradio API endpoint to serve images based on hash
|
91 |
-
@gr.api("/get_image/<hash>")
|
92 |
-
def get_image(hash):
|
93 |
-
image_path = f"{hash}.png"
|
94 |
-
if os.path.exists(image_path):
|
95 |
-
# Load and return the image
|
96 |
-
return Image.open(image_path)
|
97 |
-
else:
|
98 |
-
# Return None or a custom message if image not found
|
99 |
-
return "Image not found", 404
|
100 |
-
|
101 |
if __name__ == "__main__":
|
102 |
app.queue().launch(share=False)
|
|
|
87 |
outputs=[output_image, output_hash]
|
88 |
)
|
89 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
if __name__ == "__main__":
|
91 |
app.queue().launch(share=False)
|