Spaces:
Sleeping
Sleeping
upadate app.py
Browse files
app.py
CHANGED
|
@@ -72,13 +72,13 @@ class PredictionFeatures(BaseModel):
|
|
| 72 |
fuel: str
|
| 73 |
paint_color: str
|
| 74 |
car_type: str
|
| 75 |
-
private_parking_available:
|
| 76 |
-
has_gps:
|
| 77 |
-
has_air_conditioning:
|
| 78 |
-
automatic_car :
|
| 79 |
-
has_getaround_connect:
|
| 80 |
-
has_speed_regulator:
|
| 81 |
-
winter_tires:
|
| 82 |
|
| 83 |
|
| 84 |
@app.get("/", tags=["Introduction Endpoints"])
|
|
|
|
| 72 |
fuel: str
|
| 73 |
paint_color: str
|
| 74 |
car_type: str
|
| 75 |
+
private_parking_available: bool
|
| 76 |
+
has_gps: bool
|
| 77 |
+
has_air_conditioning: bool
|
| 78 |
+
automatic_car : bool
|
| 79 |
+
has_getaround_connect: bool
|
| 80 |
+
has_speed_regulator: bool
|
| 81 |
+
winter_tires: bool
|
| 82 |
|
| 83 |
|
| 84 |
@app.get("/", tags=["Introduction Endpoints"])
|
test.py
CHANGED
|
@@ -45,32 +45,33 @@ def test_prediction():
|
|
| 45 |
"fuel": "diesel",
|
| 46 |
"paint_color": "blue",
|
| 47 |
"car_type": "convertible",
|
| 48 |
-
"private_parking_available":
|
| 49 |
-
"has_gps":
|
| 50 |
-
"has_air_conditioning":
|
| 51 |
-
"automatic_car":
|
| 52 |
-
"has_getaround_connect":
|
| 53 |
-
"has_speed_regulator":
|
| 54 |
-
"winter_tires":
|
| 55 |
}
|
| 56 |
|
| 57 |
r = requests.post("https://marjg-getaround-api.hf.space/predict", json=payload)
|
| 58 |
|
| 59 |
-
response = r
|
| 60 |
-
print(response)
|
| 61 |
|
| 62 |
test_prediction()
|
| 63 |
|
| 64 |
|
| 65 |
#### Test batch pred
|
| 66 |
def test_batch():
|
|
|
|
| 67 |
|
| 68 |
df = pd.read_csv("https://full-stack-assets.s3.eu-west-3.amazonaws.com/Deployment/get_around_pricing_project.csv", index_col=0)
|
| 69 |
|
| 70 |
myfile = df.to_csv()
|
| 71 |
r = requests.post("https://marjg-getaround-api.hf.space/batch-predict", files={"file": myfile})
|
| 72 |
|
| 73 |
-
response = r
|
| 74 |
-
print(response)
|
| 75 |
|
| 76 |
test_batch()
|
|
|
|
| 45 |
"fuel": "diesel",
|
| 46 |
"paint_color": "blue",
|
| 47 |
"car_type": "convertible",
|
| 48 |
+
"private_parking_available": True,
|
| 49 |
+
"has_gps": True,
|
| 50 |
+
"has_air_conditioning": True,
|
| 51 |
+
"automatic_car": True,
|
| 52 |
+
"has_getaround_connect": True,
|
| 53 |
+
"has_speed_regulator": True,
|
| 54 |
+
"winter_tires": True
|
| 55 |
}
|
| 56 |
|
| 57 |
r = requests.post("https://marjg-getaround-api.hf.space/predict", json=payload)
|
| 58 |
|
| 59 |
+
response = r.json()
|
| 60 |
+
print(pd.read_json(response))
|
| 61 |
|
| 62 |
test_prediction()
|
| 63 |
|
| 64 |
|
| 65 |
#### Test batch pred
|
| 66 |
def test_batch():
|
| 67 |
+
print("###test_test_batchprediction###")
|
| 68 |
|
| 69 |
df = pd.read_csv("https://full-stack-assets.s3.eu-west-3.amazonaws.com/Deployment/get_around_pricing_project.csv", index_col=0)
|
| 70 |
|
| 71 |
myfile = df.to_csv()
|
| 72 |
r = requests.post("https://marjg-getaround-api.hf.space/batch-predict", files={"file": myfile})
|
| 73 |
|
| 74 |
+
response = r.json()
|
| 75 |
+
print(pd.read_json(response))
|
| 76 |
|
| 77 |
test_batch()
|