Spaces:
Sleeping
Sleeping
Merge remote Space changes (Example Fig Tree photo path fixes)
Browse files- .gitattributes +1 -0
- app.py +9 -4
- plant_photos/{Example Fig Tree.jpg β Example_Fig_Tree.jpg} +0 -0
.gitattributes
CHANGED
|
@@ -34,3 +34,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
plant_photos/Example[[:space:]]Fig[[:space:]]Tree.jpg filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
plant_photos/Example[[:space:]]Fig[[:space:]]Tree.jpg filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
plant_photos/Example_Fig_Tree.jpg filter=lfs diff=lfs merge=lfs -text
|
app.py
CHANGED
|
@@ -38,24 +38,29 @@ WEATHER_CITY = os.getenv("WEATHER_CITY", "Marseille")
|
|
| 38 |
DATA_ROOT = Path("user_data") # per-user gardens & photos live here
|
| 39 |
DATA_ROOT.mkdir(exist_ok=True)
|
| 40 |
STATIC_DIR = Path("static")
|
|
|
|
| 41 |
CUSTOM_CSS = (STATIC_DIR / "style.css").read_text(encoding="utf-8")
|
| 42 |
FAVICON_PATH = pixel_art.ensure_favicon()
|
|
|
|
| 43 |
# Default fallback (Marseille) β overwritten once the user submits a location
|
| 44 |
LAT = 43.2965
|
| 45 |
LON = 5.3698
|
| 46 |
|
| 47 |
|
| 48 |
# ββ Per-user paths ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
|
|
| 49 |
def _user_dir(user_id: str) -> Path:
|
| 50 |
"""Return (and create) the data directory for a given user_id."""
|
| 51 |
if not user_id:
|
| 52 |
user_id = "default"
|
| 53 |
d = DATA_ROOT / user_id
|
|
|
|
| 54 |
d.mkdir(parents=True, exist_ok=True)
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
|
|
|
|
|
|
|
| 59 |
def _garden_file(user_id: str) -> Path:
|
| 60 |
return _user_dir(user_id) / "garden.json"
|
| 61 |
|
|
@@ -621,6 +626,6 @@ if __name__ == "__main__":
|
|
| 621 |
app.launch(
|
| 622 |
theme=gr.themes.Soft(),
|
| 623 |
css=CUSTOM_CSS,
|
| 624 |
-
allowed_paths=[str(DATA_ROOT.resolve()), str(STATIC_DIR.resolve())],
|
| 625 |
favicon_path=FAVICON_PATH,
|
| 626 |
)
|
|
|
|
| 38 |
DATA_ROOT = Path("user_data") # per-user gardens & photos live here
|
| 39 |
DATA_ROOT.mkdir(exist_ok=True)
|
| 40 |
STATIC_DIR = Path("static")
|
| 41 |
+
Example_dir = Path("plant_photos")
|
| 42 |
CUSTOM_CSS = (STATIC_DIR / "style.css").read_text(encoding="utf-8")
|
| 43 |
FAVICON_PATH = pixel_art.ensure_favicon()
|
| 44 |
+
EXAMPLE_PHOTO_SRC = Path(__file__).parent / "plant_photos" / "Example_Fig_Tree.jpg"
|
| 45 |
# Default fallback (Marseille) β overwritten once the user submits a location
|
| 46 |
LAT = 43.2965
|
| 47 |
LON = 5.3698
|
| 48 |
|
| 49 |
|
| 50 |
# ββ Per-user paths ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 51 |
+
|
| 52 |
def _user_dir(user_id: str) -> Path:
|
| 53 |
"""Return (and create) the data directory for a given user_id."""
|
| 54 |
if not user_id:
|
| 55 |
user_id = "default"
|
| 56 |
d = DATA_ROOT / user_id
|
| 57 |
+
is_new = not d.exists()
|
| 58 |
d.mkdir(parents=True, exist_ok=True)
|
| 59 |
+
photos_dir = d / "plant_photos"
|
| 60 |
+
photos_dir.mkdir(exist_ok=True)
|
|
|
|
| 61 |
|
| 62 |
+
return d
|
| 63 |
+
|
| 64 |
def _garden_file(user_id: str) -> Path:
|
| 65 |
return _user_dir(user_id) / "garden.json"
|
| 66 |
|
|
|
|
| 626 |
app.launch(
|
| 627 |
theme=gr.themes.Soft(),
|
| 628 |
css=CUSTOM_CSS,
|
| 629 |
+
allowed_paths=[str(DATA_ROOT.resolve()), str(STATIC_DIR.resolve()), str(Example_dir.resolve())],
|
| 630 |
favicon_path=FAVICON_PATH,
|
| 631 |
)
|
plant_photos/{Example Fig Tree.jpg β Example_Fig_Tree.jpg}
RENAMED
|
File without changes
|