Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -59,19 +59,9 @@ def server(input: Inputs, output: Outputs, session: Session):
|
|
59 |
def uploaded_image_path() -> str:
|
60 |
"""Returns the path to the uploaded image"""
|
61 |
if input.tile_image() is not None:
|
62 |
-
return input.tile_image()[
|
63 |
else:
|
64 |
return "" # No image uploaded
|
65 |
-
|
66 |
-
# @output
|
67 |
-
# @render.ui
|
68 |
-
# def uploaded_image():
|
69 |
-
# """Displays the uploaded image"""
|
70 |
-
# img_src = uploaded_image_path()
|
71 |
-
# if img_src:
|
72 |
-
# return ui.tags.img(src="penguins.png", style={"max-width": "100%"})
|
73 |
-
# else:
|
74 |
-
# return "" # Return an empty string if no image is uploaded
|
75 |
|
76 |
@render.image
|
77 |
def uploaded_image():
|
@@ -81,17 +71,10 @@ def server(input: Inputs, output: Outputs, session: Session):
|
|
81 |
img_src = uploaded_image_path()
|
82 |
if img_src:
|
83 |
dir = Path(__file__).resolve().parent
|
84 |
-
img: ImgData = {"src": str(dir /
|
85 |
return img
|
86 |
else:
|
87 |
-
return
|
88 |
-
|
89 |
-
# @output
|
90 |
-
# @render.image
|
91 |
-
# def uploaded_image():
|
92 |
-
# img_src = uploaded_image_path()
|
93 |
-
# img: ImgData = {"src": img_src, "width": "100px"}
|
94 |
-
# return img
|
95 |
|
96 |
@reactive.Calc
|
97 |
def filtered_df() -> pd.DataFrame:
|
|
|
59 |
def uploaded_image_path() -> str:
|
60 |
"""Returns the path to the uploaded image"""
|
61 |
if input.tile_image() is not None:
|
62 |
+
return input.tile_image()['datapath'] # Assuming multiple=False
|
63 |
else:
|
64 |
return "" # No image uploaded
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
|
66 |
@render.image
|
67 |
def uploaded_image():
|
|
|
71 |
img_src = uploaded_image_path()
|
72 |
if img_src:
|
73 |
dir = Path(__file__).resolve().parent
|
74 |
+
img: ImgData = {"src": str(dir / uploaded_image_path()), "width": "100px"}
|
75 |
return img
|
76 |
else:
|
77 |
+
return None # Return an empty string if no image is uploaded
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
|
79 |
@reactive.Calc
|
80 |
def filtered_df() -> pd.DataFrame:
|