Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,12 +7,11 @@ import gradio as gr
|
|
| 7 |
|
| 8 |
app = FastAPI()
|
| 9 |
|
| 10 |
-
# ✅ Health check
|
| 11 |
@app.get("/")
|
| 12 |
def read_root():
|
| 13 |
return {"message": "House Price Prediction API is running"}
|
| 14 |
|
| 15 |
-
# ✅
|
| 16 |
def load_data():
|
| 17 |
csv_data = """area,bedrooms,age,price
|
| 18 |
1000,3,10,500000
|
|
@@ -39,7 +38,7 @@ def predict_price(model, area, bedrooms, age):
|
|
| 39 |
|
| 40 |
model = train_model()
|
| 41 |
|
| 42 |
-
# ✅ FastAPI
|
| 43 |
class HouseFeatures(BaseModel):
|
| 44 |
area: float
|
| 45 |
bedrooms: int
|
|
|
|
| 7 |
|
| 8 |
app = FastAPI()
|
| 9 |
|
|
|
|
| 10 |
@app.get("/")
|
| 11 |
def read_root():
|
| 12 |
return {"message": "House Price Prediction API is running"}
|
| 13 |
|
| 14 |
+
# ✅ Load inline dataset
|
| 15 |
def load_data():
|
| 16 |
csv_data = """area,bedrooms,age,price
|
| 17 |
1000,3,10,500000
|
|
|
|
| 38 |
|
| 39 |
model = train_model()
|
| 40 |
|
| 41 |
+
# ✅ FastAPI POST endpoint
|
| 42 |
class HouseFeatures(BaseModel):
|
| 43 |
area: float
|
| 44 |
bedrooms: int
|