Spaces:
Sleeping
Sleeping
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -8,12 +8,12 @@ PARQUET_FILE = "mera_data.parquet"
|
|
| 8 |
def search_data(query):
|
| 9 |
query = str(query).strip().lower()
|
| 10 |
pf = pq.ParquetFile(PARQUET_FILE)
|
| 11 |
-
|
| 12 |
for batch in pf.iter_batches(batch_size=10000):
|
| 13 |
for i in range(batch.num_rows):
|
| 14 |
tg_id = str(batch.column("TG_ID")[i].as_py() or "").lower()
|
| 15 |
tg_username = str(batch.column("TG_USERNAME")[i].as_py() or "").lower()
|
| 16 |
-
|
| 17 |
if query == tg_id or query == tg_username:
|
| 18 |
return {
|
| 19 |
"TG_ID": batch.column("TG_ID")[i].as_py(),
|
|
@@ -26,7 +26,7 @@ def search_data(query):
|
|
| 26 |
@app.route("/search", methods=["GET"])
|
| 27 |
def search():
|
| 28 |
query = request.args.get("search", "").strip()
|
| 29 |
-
|
| 30 |
if not query:
|
| 31 |
return jsonify({
|
| 32 |
"status": "error",
|
|
@@ -35,9 +35,9 @@ def search():
|
|
| 35 |
"owner": "Code X",
|
| 36 |
"username": "@C4DX1"
|
| 37 |
}), 400
|
| 38 |
-
|
| 39 |
result = search_data(query)
|
| 40 |
-
|
| 41 |
if result:
|
| 42 |
return jsonify({
|
| 43 |
"status": "found",
|
|
|
|
| 8 |
def search_data(query):
|
| 9 |
query = str(query).strip().lower()
|
| 10 |
pf = pq.ParquetFile(PARQUET_FILE)
|
| 11 |
+
|
| 12 |
for batch in pf.iter_batches(batch_size=10000):
|
| 13 |
for i in range(batch.num_rows):
|
| 14 |
tg_id = str(batch.column("TG_ID")[i].as_py() or "").lower()
|
| 15 |
tg_username = str(batch.column("TG_USERNAME")[i].as_py() or "").lower()
|
| 16 |
+
|
| 17 |
if query == tg_id or query == tg_username:
|
| 18 |
return {
|
| 19 |
"TG_ID": batch.column("TG_ID")[i].as_py(),
|
|
|
|
| 26 |
@app.route("/search", methods=["GET"])
|
| 27 |
def search():
|
| 28 |
query = request.args.get("search", "").strip()
|
| 29 |
+
|
| 30 |
if not query:
|
| 31 |
return jsonify({
|
| 32 |
"status": "error",
|
|
|
|
| 35 |
"owner": "Code X",
|
| 36 |
"username": "@C4DX1"
|
| 37 |
}), 400
|
| 38 |
+
|
| 39 |
result = search_data(query)
|
| 40 |
+
|
| 41 |
if result:
|
| 42 |
return jsonify({
|
| 43 |
"status": "found",
|