refactored code
Browse files
main.py
CHANGED
|
@@ -1,4 +1,10 @@
|
|
| 1 |
import os
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
from fastapi import FastAPI, File, UploadFile, Form
|
| 3 |
from fastapi.middleware.cors import CORSMiddleware
|
| 4 |
from fastapi.responses import Response
|
|
@@ -9,11 +15,6 @@ import numpy as np
|
|
| 9 |
from lang_sam import LangSAM
|
| 10 |
import supervision as sv
|
| 11 |
|
| 12 |
-
# Set Hugging Face cache directory to /tmp
|
| 13 |
-
os.environ["HF_HOME"] = "/tmp/huggingface"
|
| 14 |
-
os.environ["TRANSFORMERS_CACHE"] = "/tmp/huggingface"
|
| 15 |
-
os.environ["TORCH_HOME"] = "/tmp/torch"
|
| 16 |
-
|
| 17 |
app = FastAPI()
|
| 18 |
|
| 19 |
# Enable CORS for all origins
|
|
|
|
| 1 |
import os
|
| 2 |
+
|
| 3 |
+
# Set Hugging Face cache directory to /tmp
|
| 4 |
+
os.environ["HF_HOME"] = "/tmp/huggingface"
|
| 5 |
+
os.environ["TRANSFORMERS_CACHE"] = "/tmp/huggingface"
|
| 6 |
+
os.environ["TORCH_HOME"] = "/tmp/torch"
|
| 7 |
+
|
| 8 |
from fastapi import FastAPI, File, UploadFile, Form
|
| 9 |
from fastapi.middleware.cors import CORSMiddleware
|
| 10 |
from fastapi.responses import Response
|
|
|
|
| 15 |
from lang_sam import LangSAM
|
| 16 |
import supervision as sv
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
app = FastAPI()
|
| 19 |
|
| 20 |
# Enable CORS for all origins
|