Вы не можете выбрать более 25 тем
Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
20 строки
425 B
Python
20 строки
425 B
Python
|
|
import random
|
|
from fastapi import FastAPI
|
|
from api_handler import FastAPIHandler
|
|
|
|
app = FastAPI()
|
|
app.handler = FastAPIHandler()
|
|
|
|
@app.get('/')
|
|
def root_dir():
|
|
return({'Hello': 'world'})
|
|
|
|
@app.post('/api/prediction')
|
|
def make_prediction(flat_id: int, item_features: dict):
|
|
prediction = app.handler.predict(item_features)
|
|
return ({
|
|
'price': prediction,
|
|
'flat_id': flat_id
|
|
})
|