Spaces:
Sleeping
Sleeping
Update core/extractor.py
Browse files- core/extractor.py +2 -4
core/extractor.py
CHANGED
|
@@ -3,18 +3,16 @@ import streamlit as st
|
|
| 3 |
|
| 4 |
class ExtractorEngine:
|
| 5 |
def __init__(self):
|
| 6 |
-
# URL de votre SECOND Space (l'API que vous avez déjà créée)
|
| 7 |
self.api_url = "https://klydekushy-prospectusveritas-api.hf.space/extract"
|
| 8 |
|
| 9 |
def extract_graph(self, text: str):
|
| 10 |
-
# On
|
| 11 |
payload = {"text": text[:3500], "max_tokens": 1024, "temperature": 0.1}
|
| 12 |
try:
|
| 13 |
-
# Attente de 3 minutes max
|
| 14 |
response = requests.post(self.api_url, json=payload, timeout=180)
|
| 15 |
if response.status_code == 200:
|
| 16 |
return response.json().get("result")
|
| 17 |
return None
|
| 18 |
except Exception as e:
|
| 19 |
-
st.error(f"Erreur
|
| 20 |
return None
|
|
|
|
| 3 |
|
| 4 |
class ExtractorEngine:
|
| 5 |
def __init__(self):
|
|
|
|
| 6 |
self.api_url = "https://klydekushy-prospectusveritas-api.hf.space/extract"
|
| 7 |
|
| 8 |
def extract_graph(self, text: str):
|
| 9 |
+
# On envoie un morceau raisonnable pour le CPU
|
| 10 |
payload = {"text": text[:3500], "max_tokens": 1024, "temperature": 0.1}
|
| 11 |
try:
|
|
|
|
| 12 |
response = requests.post(self.api_url, json=payload, timeout=180)
|
| 13 |
if response.status_code == 200:
|
| 14 |
return response.json().get("result")
|
| 15 |
return None
|
| 16 |
except Exception as e:
|
| 17 |
+
st.error(f"Erreur : {e}")
|
| 18 |
return None
|