Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
ts authentication
Browse files- app/main.py +5 -3
app/main.py
CHANGED
|
@@ -17,6 +17,10 @@ config = getconfig("params.cfg")
|
|
| 17 |
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
| 18 |
logger = logging.getLogger(__name__)
|
| 19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
# WHISP API configuration
|
| 21 |
WHISP_API_URL = config.get('whisp', 'WHISP_API_URL', fallback="https://giz-chatfed-whisp.hf.space/")
|
| 22 |
|
|
@@ -89,9 +93,7 @@ Fecha de análisis: {datetime.now().isoformat()}"""
|
|
| 89 |
def process_geojson_whisp(file_content: bytes, filename: str) -> tuple[str, dict]:
|
| 90 |
"""Process GeoJSON file through WHISP API and return formatted context"""
|
| 91 |
try:
|
| 92 |
-
|
| 93 |
-
if not hf_token:
|
| 94 |
-
raise ValueError("HF_TOKEN environment variable not found. Please set it in your Space secrets.")
|
| 95 |
|
| 96 |
# Create temporary file for WHISP API
|
| 97 |
import tempfile
|
|
|
|
| 17 |
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
| 18 |
logger = logging.getLogger(__name__)
|
| 19 |
|
| 20 |
+
hf_token = os.getenv('HF_TOKEN')
|
| 21 |
+
if not hf_token:
|
| 22 |
+
raise ValueError("HF_TOKEN environment variable not found. Please set it in Space secrets.")
|
| 23 |
+
|
| 24 |
# WHISP API configuration
|
| 25 |
WHISP_API_URL = config.get('whisp', 'WHISP_API_URL', fallback="https://giz-chatfed-whisp.hf.space/")
|
| 26 |
|
|
|
|
| 93 |
def process_geojson_whisp(file_content: bytes, filename: str) -> tuple[str, dict]:
|
| 94 |
"""Process GeoJSON file through WHISP API and return formatted context"""
|
| 95 |
try:
|
| 96 |
+
|
|
|
|
|
|
|
| 97 |
|
| 98 |
# Create temporary file for WHISP API
|
| 99 |
import tempfile
|