Spaces:
Running
Running
fix: import dynamique de install_agrilens depuis la racine (compatibilité Hugging Face Spaces)
Browse files- src/streamlit_app.py +2 -0
src/streamlit_app.py
CHANGED
@@ -1,11 +1,13 @@
|
|
1 |
import streamlit as st
|
2 |
import os
|
3 |
import torch
|
|
|
4 |
# --- Initialisation robuste de la clé camera_images (anti-KeyError) ---
|
5 |
if 'camera_images' not in st.session_state:
|
6 |
st.session_state['camera_images'] = []
|
7 |
# --- Vérification et installation automatique du modèle Gemma local ---
|
8 |
if not os.path.isdir("models/gemma-3n-transformers-gemma-3n-e2b-it-v1"):
|
|
|
9 |
import install_agrilens
|
10 |
# --- Mode hybride démo/réel pour Hugging Face Spaces ---
|
11 |
HF_TOKEN = os.environ.get('HF_TOKEN')
|
|
|
1 |
import streamlit as st
|
2 |
import os
|
3 |
import torch
|
4 |
+
import sys
|
5 |
# --- Initialisation robuste de la clé camera_images (anti-KeyError) ---
|
6 |
if 'camera_images' not in st.session_state:
|
7 |
st.session_state['camera_images'] = []
|
8 |
# --- Vérification et installation automatique du modèle Gemma local ---
|
9 |
if not os.path.isdir("models/gemma-3n-transformers-gemma-3n-e2b-it-v1"):
|
10 |
+
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
|
11 |
import install_agrilens
|
12 |
# --- Mode hybride démo/réel pour Hugging Face Spaces ---
|
13 |
HF_TOKEN = os.environ.get('HF_TOKEN')
|