Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -42,7 +42,7 @@ app_ui = ui.page_fillable(
|
|
| 42 |
ui.input_switch("by_species", "Show species", value=True),
|
| 43 |
ui.input_switch("show_margins", "Show marginal plots", value=True),
|
| 44 |
),
|
| 45 |
-
ui.
|
| 46 |
ui.output_ui("value_boxes"),
|
| 47 |
ui.output_plot("scatter", fill=True),
|
| 48 |
ui.help_text(
|
|
@@ -63,15 +63,23 @@ def server(input: Inputs, output: Outputs, session: Session):
|
|
| 63 |
else:
|
| 64 |
return "" # No image uploaded
|
| 65 |
|
| 66 |
-
@output
|
| 67 |
-
@render.ui
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
def uploaded_image():
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
return "" # Return an empty string if no image is uploaded
|
| 75 |
|
| 76 |
# @output
|
| 77 |
# @render.image
|
|
|
|
| 42 |
ui.input_switch("by_species", "Show species", value=True),
|
| 43 |
ui.input_switch("show_margins", "Show marginal plots", value=True),
|
| 44 |
),
|
| 45 |
+
ui.output_image("uploaded_image"), # display the uploaded TIFF sidewalk tile image
|
| 46 |
ui.output_ui("value_boxes"),
|
| 47 |
ui.output_plot("scatter", fill=True),
|
| 48 |
ui.help_text(
|
|
|
|
| 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():
|
| 78 |
+
from pathlib import Path
|
| 79 |
+
|
| 80 |
+
dir = Path(__file__).resolve().parent
|
| 81 |
+
img: ImgData = {"src": str(dir / uploaded_image_path()), "width": "100px"}
|
| 82 |
+
return img
|
|
|
|
| 83 |
|
| 84 |
# @output
|
| 85 |
# @render.image
|