Spaces:
Sleeping
Sleeping
edited main.py backend
Browse files- backend/main.py +8 -1
backend/main.py
CHANGED
|
@@ -22,4 +22,11 @@ def predict_endpoint(data: dict | list[dict]):
|
|
| 22 |
# Convert single row or multiple rows to DataFrame
|
| 23 |
df = pd.DataFrame(data if isinstance(data, list) else [data])
|
| 24 |
predictions = predict(df)
|
| 25 |
-
return predictions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
# Convert single row or multiple rows to DataFrame
|
| 23 |
df = pd.DataFrame(data if isinstance(data, list) else [data])
|
| 24 |
predictions = predict(df)
|
| 25 |
+
return predictions
|
| 26 |
+
|
| 27 |
+
if __name__ == "__main__":
|
| 28 |
+
import uvicorn
|
| 29 |
+
|
| 30 |
+
# Pass the app as an import string: "module_name:app_variable_name"
|
| 31 |
+
# In this case, "main:app" because your file is main.py and your app object is named 'app'
|
| 32 |
+
uvicorn.run("main:app", host="127.0.0.1", port=8000, reload=True)
|