Spaces:
No application file
No application file
Download app.py from CodeXDevloper/codex: direct link, hf CLI and curl.
- Browser
- Download file 724 Bytes
-
https://huggingface.co/spaces/CodeXDevloper/codex/resolve/7ea09ac0a51316edd17747caa8f094bf005a4770/app.py
- Command line
-
hf download hf://spaces/CodeXDevloper/codex@7ea09ac0a51316edd17747caa8f094bf005a4770/app.py
-
curl -L -o app.py https://huggingface.co/spaces/CodeXDevloper/codex/resolve/7ea09ac0a51316edd17747caa8f094bf005a4770/app.py
724 Bytes
| from fastapi import FastAPI, Query | |
| from fastapi.middleware.cors import CORSMiddleware | |
| from datasets import load_dataset | |
| import os | |
| app = FastAPI(title="Telegram UID Search") | |
| app.add_middleware( | |
| CORSMiddleware, | |
| allow_origins=["*"], | |
| allow_methods=["*"], | |
| allow_headers=["*"], | |
| ) | |
| DATASET = "CodeXDevloper/MergedTgDataset" | |
| def root(): | |
| return {"status": "running"} | |
| def search_uid(uid: str = Query(...)): | |
| # Lazy loading — dataset sirf search ke time load hoga | |
| ds = load_dataset(DATASET, split="train", streaming=True) | |
| for row in ds: | |
| if uid == str(row.get("user_id", "")): | |
| return {"found": True, "data": row} | |
| return {"found": False} |