Spaces:
Sleeping
Sleeping
modif app.py
Browse files
app.py
CHANGED
|
@@ -169,7 +169,8 @@ async def filter_by(filterBy: FilterBy):
|
|
| 169 |
|
| 170 |
if filterBy.by_category != None:
|
| 171 |
df = df[df[filterBy.column].isin(filterBy.by_category)]
|
| 172 |
-
|
|
|
|
| 173 |
else:
|
| 174 |
msg = "Please chose a column to filter by"
|
| 175 |
return msg
|
|
|
|
| 169 |
|
| 170 |
if filterBy.by_category != None:
|
| 171 |
df = df[df[filterBy.column].isin(filterBy.by_category)]
|
| 172 |
+
df = df.reset_index()
|
| 173 |
+
return df.to_dict(orient="records")
|
| 174 |
else:
|
| 175 |
msg = "Please chose a column to filter by"
|
| 176 |
return msg
|
test.py
CHANGED
|
@@ -53,8 +53,8 @@ def test_filterBy():
|
|
| 53 |
r = requests.post("https://marjg-getaround-api.hf.space/filter-by", json=payload)
|
| 54 |
|
| 55 |
response = r.json()
|
| 56 |
-
print(pd.
|
| 57 |
-
|
| 58 |
test_filterBy()
|
| 59 |
|
| 60 |
|
|
|
|
| 53 |
r = requests.post("https://marjg-getaround-api.hf.space/filter-by", json=payload)
|
| 54 |
|
| 55 |
response = r.json()
|
| 56 |
+
print(pd.DataFrame(response))
|
| 57 |
+
|
| 58 |
test_filterBy()
|
| 59 |
|
| 60 |
|