D Ф m i И i q ц e L Ф y e r commited on
Commit ·
5692ae0
1
Parent(s): 31be835
update: Sync with latest code and enable Full ML features
Browse files- requirements.txt +6 -3
- syscred/backend_app.py +27 -15
- syscred/static/index.html +1 -1
requirements.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
# SysCRED -
|
| 2 |
# Système Hybride de Vérification de Crédibilité
|
| 3 |
# (c) Dominique S. Loyer
|
| 4 |
|
|
@@ -10,7 +10,7 @@ python-whois>=0.8.0
|
|
| 10 |
# === RDF/Ontology ===
|
| 11 |
rdflib>=6.0.0
|
| 12 |
|
| 13 |
-
# === Machine Learning
|
| 14 |
transformers>=4.30.0
|
| 15 |
torch>=2.0.0
|
| 16 |
numpy>=1.24.0
|
|
@@ -28,4 +28,7 @@ pandas>=2.0.0
|
|
| 28 |
# === Production/Database ===
|
| 29 |
gunicorn>=20.1.0
|
| 30 |
psycopg2-binary>=2.9.0
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SysCRED - Requirements
|
| 2 |
# Système Hybride de Vérification de Crédibilité
|
| 3 |
# (c) Dominique S. Loyer
|
| 4 |
|
|
|
|
| 10 |
# === RDF/Ontology ===
|
| 11 |
rdflib>=6.0.0
|
| 12 |
|
| 13 |
+
# === Machine Learning ===
|
| 14 |
transformers>=4.30.0
|
| 15 |
torch>=2.0.0
|
| 16 |
numpy>=1.24.0
|
|
|
|
| 28 |
# === Production/Database ===
|
| 29 |
gunicorn>=20.1.0
|
| 30 |
psycopg2-binary>=2.9.0
|
| 31 |
+
flask_sqlalchemy>=3.0.0
|
| 32 |
+
|
| 33 |
+
# === Development/Testing ===
|
| 34 |
+
pytest>=7.0.0
|
syscred/backend_app.py
CHANGED
|
@@ -37,27 +37,21 @@ from flask_cors import CORS
|
|
| 37 |
# Add syscred package to path
|
| 38 |
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
| 39 |
|
| 40 |
-
# Import SysCRED modules
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
try:
|
| 42 |
from syscred.verification_system import CredibilityVerificationSystem
|
| 43 |
from syscred.seo_analyzer import SEOAnalyzer
|
| 44 |
from syscred.ontology_manager import OntologyManager
|
| 45 |
-
from syscred.ontology_manager import OntologyManager
|
| 46 |
from syscred.config import config, Config
|
| 47 |
-
from syscred.database import init_db, db, AnalysisResult
|
| 48 |
-
# TREC modules
|
| 49 |
-
from syscred.trec_retriever import TRECRetriever, Evidence, RetrievalResult
|
| 50 |
-
from syscred.eval_metrics import EvaluationMetrics
|
| 51 |
SYSCRED_AVAILABLE = True
|
| 52 |
-
|
| 53 |
-
print("[SysCRED Backend] Modules imported successfully (including TREC)")
|
| 54 |
except ImportError as e:
|
| 55 |
-
|
| 56 |
-
TREC_AVAILABLE = False
|
| 57 |
-
print(f"[SysCRED Backend] Warning: Could not import modules: {e}")
|
| 58 |
-
# Define dummy init_db to prevent crash
|
| 59 |
-
def init_db(app): pass
|
| 60 |
-
|
| 61 |
# Fallback config
|
| 62 |
class Config:
|
| 63 |
HOST = "0.0.0.0"
|
|
@@ -69,6 +63,24 @@ except ImportError as e:
|
|
| 69 |
GOOGLE_FACT_CHECK_API_KEY = None
|
| 70 |
config = Config()
|
| 71 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
# --- Initialize Flask App ---
|
| 73 |
app = Flask(__name__)
|
| 74 |
CORS(app) # Enable CORS for frontend
|
|
@@ -613,4 +625,4 @@ if __name__ == '__main__':
|
|
| 613 |
print(" - GET /api/trec/health - TREC module health")
|
| 614 |
print()
|
| 615 |
|
| 616 |
-
app.run(host='0.0.0.0', port=5001, debug=True)
|
|
|
|
| 37 |
# Add syscred package to path
|
| 38 |
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
| 39 |
|
| 40 |
+
# Import SysCRED modules (with graceful fallbacks)
|
| 41 |
+
SYSCRED_AVAILABLE = False
|
| 42 |
+
TREC_AVAILABLE = False
|
| 43 |
+
DB_AVAILABLE = False
|
| 44 |
+
|
| 45 |
+
# Core modules (required)
|
| 46 |
try:
|
| 47 |
from syscred.verification_system import CredibilityVerificationSystem
|
| 48 |
from syscred.seo_analyzer import SEOAnalyzer
|
| 49 |
from syscred.ontology_manager import OntologyManager
|
|
|
|
| 50 |
from syscred.config import config, Config
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
SYSCRED_AVAILABLE = True
|
| 52 |
+
print("[SysCRED Backend] Core modules imported successfully")
|
|
|
|
| 53 |
except ImportError as e:
|
| 54 |
+
print(f"[SysCRED Backend] Warning: Core modules failed: {e}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
# Fallback config
|
| 56 |
class Config:
|
| 57 |
HOST = "0.0.0.0"
|
|
|
|
| 63 |
GOOGLE_FACT_CHECK_API_KEY = None
|
| 64 |
config = Config()
|
| 65 |
|
| 66 |
+
# Database (optional)
|
| 67 |
+
try:
|
| 68 |
+
from syscred.database import init_db, db, AnalysisResult
|
| 69 |
+
DB_AVAILABLE = True
|
| 70 |
+
print("[SysCRED Backend] Database module loaded")
|
| 71 |
+
except ImportError as e:
|
| 72 |
+
print(f"[SysCRED Backend] Database disabled: {e}")
|
| 73 |
+
def init_db(app): pass
|
| 74 |
+
|
| 75 |
+
# TREC modules (optional)
|
| 76 |
+
try:
|
| 77 |
+
from syscred.trec_retriever import TRECRetriever, Evidence, RetrievalResult
|
| 78 |
+
from syscred.eval_metrics import EvaluationMetrics
|
| 79 |
+
TREC_AVAILABLE = True
|
| 80 |
+
print("[SysCRED Backend] TREC modules loaded")
|
| 81 |
+
except ImportError as e:
|
| 82 |
+
print(f"[SysCRED Backend] TREC modules disabled: {e}")
|
| 83 |
+
|
| 84 |
# --- Initialize Flask App ---
|
| 85 |
app = Flask(__name__)
|
| 86 |
CORS(app) # Enable CORS for frontend
|
|
|
|
| 625 |
print(" - GET /api/trec/health - TREC module health")
|
| 626 |
print()
|
| 627 |
|
| 628 |
+
app.run(host='0.0.0.0', port=5001, debug=False, threaded=True)
|
syscred/static/index.html
CHANGED
|
@@ -470,7 +470,7 @@
|
|
| 470 |
// Backend URLs
|
| 471 |
const LOCAL_API_URL = 'http://localhost:5001';
|
| 472 |
const REMOTE_API_URL = 'https://domloyer-syscred.hf.space';
|
| 473 |
-
let API_URL =
|
| 474 |
|
| 475 |
function toggleBackend() {
|
| 476 |
const toggle = document.getElementById('backendToggle');
|
|
|
|
| 470 |
// Backend URLs
|
| 471 |
const LOCAL_API_URL = 'http://localhost:5001';
|
| 472 |
const REMOTE_API_URL = 'https://domloyer-syscred.hf.space';
|
| 473 |
+
let API_URL = '';
|
| 474 |
|
| 475 |
function toggleBackend() {
|
| 476 |
const toggle = document.getElementById('backendToggle');
|