MarjG commited on
Commit
e5bb869
·
1 Parent(s): 891a6cc

upadate app.py

Browse files
Files changed (2) hide show
  1. app.py +7 -7
  2. test.py +12 -11
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: Literal["True", "False"]
76
- has_gps: Literal["True", "False"]
77
- has_air_conditioning: Literal["True", "False"]
78
- automatic_car : Literal["True", "False"]
79
- has_getaround_connect: Literal["True", "False"]
80
- has_speed_regulator: Literal["True", "False"]
81
- winter_tires: Literal["True", "False"]
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": "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
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()