Spaces:
Running
Running
Commit
·
60ae242
1
Parent(s):
eae75bd
add
Browse files- Dockerfile +1 -1
- apiServer.py +18 -0
- app.py +1 -1
Dockerfile
CHANGED
|
@@ -17,7 +17,7 @@ RUN git clone https://github.com/ROCm/flash-attention.git && cd flash-attention
|
|
| 17 |
|
| 18 |
RUN pip install spaces easydict ftfy imageio
|
| 19 |
|
| 20 |
-
RUN git clone https://huggingface.co/spaces/vivienfanghua/wan2.2_enhanced_amd && cd wan2.2_enhanced_amd
|
| 21 |
|
| 22 |
WORKDIR /app/wan2.2_enhanced_amd
|
| 23 |
|
|
|
|
| 17 |
|
| 18 |
RUN pip install spaces easydict ftfy imageio
|
| 19 |
|
| 20 |
+
RUN git clone https://huggingface.co/spaces/vivienfanghua/wan2.2_enhanced_amd && cd wan2.2_enhanced_amd
|
| 21 |
|
| 22 |
WORKDIR /app/wan2.2_enhanced_amd
|
| 23 |
|
apiServer.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastapi import FastAPI, File, UploadFile
|
| 2 |
+
from fastapi.responses import FileResponse
|
| 3 |
+
import os
|
| 4 |
+
|
| 5 |
+
app = FastAPI()
|
| 6 |
+
UPLOAD_FOLDER = "uploads"
|
| 7 |
+
os.makedirs(UPLOAD_FOLDER, exist_ok=True)
|
| 8 |
+
|
| 9 |
+
@app.post("/upload/")
|
| 10 |
+
async def upload(file: UploadFile = File(...)):
|
| 11 |
+
file_path = os.path.join(UPLOAD_FOLDER, file.filename)
|
| 12 |
+
with open(file_path, "wb") as f:
|
| 13 |
+
f.write(await file.read())
|
| 14 |
+
return {"url": f"http://<your-server-ip>:8000/files/{file.filename}"}
|
| 15 |
+
|
| 16 |
+
@app.get("/files/{filename}")
|
| 17 |
+
async def get_file(filename: str):
|
| 18 |
+
return FileResponse(os.path.join(UPLOAD_FOLDER, filename))
|
app.py
CHANGED
|
@@ -384,4 +384,4 @@ with gr.Blocks(css=css, theme=gr.themes.Soft(), delete_cache=(60, 900)) as demo:
|
|
| 384 |
)
|
| 385 |
|
| 386 |
if __name__ == "__main__":
|
| 387 |
-
demo.launch(server_name="0.0.0.0", server_port=7860)
|
|
|
|
| 384 |
)
|
| 385 |
|
| 386 |
if __name__ == "__main__":
|
| 387 |
+
demo.launch(server_name="0.0.0.0", server_port=7860, share=True)
|