Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,6 +2,7 @@ import streamlit as st
|
|
| 2 |
import subprocess
|
| 3 |
from PIL import Image
|
| 4 |
import tempfile
|
|
|
|
| 5 |
|
| 6 |
# Streamlit app title
|
| 7 |
st.title("Reflection Removal App")
|
|
@@ -44,3 +45,26 @@ if uploaded_file is not None:
|
|
| 44 |
# Display error if any
|
| 45 |
if stderr:
|
| 46 |
st.error(stderr.decode('utf-8'))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
import subprocess
|
| 3 |
from PIL import Image
|
| 4 |
import tempfile
|
| 5 |
+
import os
|
| 6 |
|
| 7 |
# Streamlit app title
|
| 8 |
st.title("Reflection Removal App")
|
|
|
|
| 45 |
# Display error if any
|
| 46 |
if stderr:
|
| 47 |
st.error(stderr.decode('utf-8'))
|
| 48 |
+
|
| 49 |
+
# Search for image ending with '_l' in subdirectories of 'checkpoints'
|
| 50 |
+
checkpoints_dir = './DSRNet/checkpoints' # Update this path according to your project structure
|
| 51 |
+
|
| 52 |
+
# Function to recursively find image ending with '_l'
|
| 53 |
+
def find_image_in_subdirs(root_dir):
|
| 54 |
+
for root, dirs, files in os.walk(root_dir):
|
| 55 |
+
for filename in files:
|
| 56 |
+
if filename.endswith('_l.png'): # Adjust file extension if needed
|
| 57 |
+
return os.path.join(root, filename)
|
| 58 |
+
return None
|
| 59 |
+
|
| 60 |
+
# Find the image file
|
| 61 |
+
desired_image = find_image_in_subdirs(checkpoints_dir)
|
| 62 |
+
|
| 63 |
+
# Display the found image if available
|
| 64 |
+
if desired_image is not None:
|
| 65 |
+
st.write("Found Image:")
|
| 66 |
+
image_l = Image.open(desired_image)
|
| 67 |
+
st.image(image_l, caption='Image ending with _l', use_column_width=True)
|
| 68 |
+
else:
|
| 69 |
+
st.write("Image ending with _l not found in checkpoints directory.")
|
| 70 |
+
|