warmifans commited on
Commit
433d061
·
verified ·
1 Parent(s): 42b37ae

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -40
app.py DELETED
@@ -1,40 +0,0 @@
1
- from fastapi import FastAPI
2
- import duckdb
3
-
4
- app = FastAPI()
5
-
6
- HF_FILE = "hf://datasets/warmifans/Inddatainonefile@main/users_data.parquet"
7
-
8
- duckdb.sql("INSTALL httpfs;")
9
- duckdb.sql("LOAD httpfs;")
10
-
11
- @app.get("/")
12
- def home():
13
- return {
14
- "status": "API running"
15
- }
16
-
17
- @app.get("/search")
18
- def search(email: str):
19
- try:
20
- query = f"""
21
- SELECT *
22
- FROM read_parquet('{HF_FILE}')
23
- WHERE lower(email)=lower('{email}')
24
- """
25
-
26
- df = duckdb.query(query).to_df()
27
-
28
- if df.empty:
29
- return {
30
- "found": 0,
31
- "data": []
32
- }
33
-
34
- return {
35
- "found": len(df),
36
- "data": df.to_dict(orient="records")
37
- }
38
-
39
- except Exception as e:
40
- return {"error": str(e)}