Update app.py
Browse files
app.py
CHANGED
|
@@ -5,6 +5,7 @@ import uuid
|
|
| 5 |
import subprocess
|
| 6 |
from fastapi import FastAPI, UploadFile, File, HTTPException
|
| 7 |
from fastapi.responses import FileResponse
|
|
|
|
| 8 |
from PIL import Image
|
| 9 |
|
| 10 |
# Add the cloned repository to the system path so Python can locate the modules
|
|
@@ -15,6 +16,15 @@ from hy3dgen.texgen import Hunyuan3DPaintPipeline
|
|
| 15 |
|
| 16 |
app = FastAPI(title="Hunyuan3D-2 Multi-View Textured API")
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
shape_pipeline = None
|
| 19 |
paint_pipeline = None
|
| 20 |
OUTPUT_DIR = "/app/outputs"
|
|
|
|
| 5 |
import subprocess
|
| 6 |
from fastapi import FastAPI, UploadFile, File, HTTPException
|
| 7 |
from fastapi.responses import FileResponse
|
| 8 |
+
from fastapi.middleware.cors import CORSMiddleware
|
| 9 |
from PIL import Image
|
| 10 |
|
| 11 |
# Add the cloned repository to the system path so Python can locate the modules
|
|
|
|
| 16 |
|
| 17 |
app = FastAPI(title="Hunyuan3D-2 Multi-View Textured API")
|
| 18 |
|
| 19 |
+
# Add CORS so your HTML file can communicate with the API
|
| 20 |
+
app.add_middleware(
|
| 21 |
+
CORSMiddleware,
|
| 22 |
+
allow_origins=["*"],
|
| 23 |
+
allow_credentials=True,
|
| 24 |
+
allow_methods=["*"],
|
| 25 |
+
allow_headers=["*"],
|
| 26 |
+
)
|
| 27 |
+
|
| 28 |
shape_pipeline = None
|
| 29 |
paint_pipeline = None
|
| 30 |
OUTPUT_DIR = "/app/outputs"
|