Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,7 +2,7 @@ from fastapi import FastAPI, File, UploadFile, Form, HTTPException
|
|
| 2 |
from fastapi.responses import JSONResponse
|
| 3 |
from fastapi.middleware.cors import CORSMiddleware
|
| 4 |
from contextlib import asynccontextmanager
|
| 5 |
-
|
| 6 |
import pandas as pd
|
| 7 |
import numpy as np
|
| 8 |
import torch
|
|
@@ -236,4 +236,8 @@ def prepare_time_data(df):
|
|
| 236 |
return df
|
| 237 |
except Exception as e:
|
| 238 |
logger.error(f"Error preparing time data: {str(e)}")
|
| 239 |
-
raise
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
from fastapi.responses import JSONResponse
|
| 3 |
from fastapi.middleware.cors import CORSMiddleware
|
| 4 |
from contextlib import asynccontextmanager
|
| 5 |
+
import uvicorn
|
| 6 |
import pandas as pd
|
| 7 |
import numpy as np
|
| 8 |
import torch
|
|
|
|
| 236 |
return df
|
| 237 |
except Exception as e:
|
| 238 |
logger.error(f"Error preparing time data: {str(e)}")
|
| 239 |
+
raise
|
| 240 |
+
|
| 241 |
+
if __name__ == "__main__":
|
| 242 |
+
port = int(os.environ.get("PORT", 7860)) # Hugging Face Spaces sử dụng cổng 7860
|
| 243 |
+
uvicorn.run("app:app", host="0.0.0.0", port=port, reload=True)
|