kyu30 commited on
Commit
b5d464f
·
1 Parent(s): 8575734

merging fixes

Browse files
Files changed (2) hide show
  1. backend/app.py +11 -1
  2. main.py +4 -10
backend/app.py CHANGED
@@ -14,7 +14,17 @@ from pydantic import BaseModel, Field
14
  from sklearn.feature_extraction.text import TfidfVectorizer
15
  from sklearn.metrics.pairwise import cosine_similarity
16
 
17
- from llm_confidence import score_subclaim_to_superclaim_confidence, suggest_original_superclaim_text
 
 
 
 
 
 
 
 
 
 
18
 
19
 
20
  # Repo root (parent of `backend/`) — claim JSON lives next to `backend/`, not inside it.
 
14
  from sklearn.feature_extraction.text import TfidfVectorizer
15
  from sklearn.metrics.pairwise import cosine_similarity
16
 
17
+ try:
18
+ from .llm_confidence import (
19
+ score_subclaim_to_superclaim_confidence,
20
+ suggest_original_superclaim_text,
21
+ )
22
+ except ImportError:
23
+ # `cd backend && uvicorn app:app` (legacy local): no package parent.
24
+ from llm_confidence import (
25
+ score_subclaim_to_superclaim_confidence,
26
+ suggest_original_superclaim_text,
27
+ )
28
 
29
 
30
  # Repo root (parent of `backend/`) — claim JSON lives next to `backend/`, not inside it.
main.py CHANGED
@@ -1,16 +1,10 @@
1
  """
2
- Vercel FastAPI entrypoint (official pattern: root `main.py` exporting `app`).
3
- Implementation lives in `backend/app.py`.
 
4
  """
5
  from __future__ import annotations
6
 
7
- import sys
8
- from pathlib import Path
9
-
10
- _backend = Path(__file__).resolve().parent / "backend"
11
- if _backend.is_dir() and str(_backend) not in sys.path:
12
- sys.path.insert(0, str(_backend))
13
-
14
- from app import app # noqa: E402
15
 
16
  __all__ = ["app"]
 
1
  """
2
+ Vercel FastAPI entry: import the ASGI app as a real package so the bundler
3
+ includes ``backend/`` (dynamic ``sys.path`` hacks are not traced on deploy).
4
+ Local: ``uvicorn main:app`` or ``uvicorn backend.app:app`` from repo root.
5
  """
6
  from __future__ import annotations
7
 
8
+ from backend.app import app
 
 
 
 
 
 
 
9
 
10
  __all__ = ["app"]