Spaces:
Sleeping
Sleeping
Use HF dataset + fix ticker column + serve index.html
Browse files
app.py
CHANGED
|
@@ -28,7 +28,7 @@ app.add_middleware(
|
|
| 28 |
)
|
| 29 |
|
| 30 |
# ---------------------------------------------------------
|
| 31 |
-
# Load Hugging Face dataset (
|
| 32 |
# ---------------------------------------------------------
|
| 33 |
DATASET_NAME = "kurry/sp500_earnings_transcripts"
|
| 34 |
dataset_cache = None
|
|
@@ -71,7 +71,7 @@ def serve_index():
|
|
| 71 |
@app.get("/tickers")
|
| 72 |
def get_tickers():
|
| 73 |
ds = load_hf_dataset()
|
| 74 |
-
tickers = sorted(set(ds["
|
| 75 |
return {"tickers": tickers}
|
| 76 |
|
| 77 |
# ---------------------------------------------------------
|
|
@@ -84,7 +84,7 @@ def get_transcript(symbol: str):
|
|
| 84 |
|
| 85 |
logger.info(f"Fetching transcript for: {symbol}")
|
| 86 |
|
| 87 |
-
rows = [r for r in ds if r["
|
| 88 |
|
| 89 |
if not rows:
|
| 90 |
raise HTTPException(status_code=404, detail=f"No transcript found for {symbol}")
|
|
|
|
| 28 |
)
|
| 29 |
|
| 30 |
# ---------------------------------------------------------
|
| 31 |
+
# Load Hugging Face dataset (lazy load)
|
| 32 |
# ---------------------------------------------------------
|
| 33 |
DATASET_NAME = "kurry/sp500_earnings_transcripts"
|
| 34 |
dataset_cache = None
|
|
|
|
| 71 |
@app.get("/tickers")
|
| 72 |
def get_tickers():
|
| 73 |
ds = load_hf_dataset()
|
| 74 |
+
tickers = sorted(set([t.upper() for t in ds["ticker"]]))
|
| 75 |
return {"tickers": tickers}
|
| 76 |
|
| 77 |
# ---------------------------------------------------------
|
|
|
|
| 84 |
|
| 85 |
logger.info(f"Fetching transcript for: {symbol}")
|
| 86 |
|
| 87 |
+
rows = [r for r in ds if r["ticker"].upper() == symbol]
|
| 88 |
|
| 89 |
if not rows:
|
| 90 |
raise HTTPException(status_code=404, detail=f"No transcript found for {symbol}")
|