update imports
Browse files
main.py
CHANGED
@@ -1,15 +1,19 @@
|
|
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
|
9 |
-
from fastapi.middleware.cors import CORSMiddleware
|
10 |
-
import uvicorn
|
11 |
-
from lang_sam import LangSAM
|
12 |
-
|
13 |
app = FastAPI()
|
14 |
|
15 |
# Enable CORS for all origins
|
|
|
1 |
import os
|
2 |
+
from fastapi import FastAPI, File, UploadFile, Form
|
3 |
+
from fastapi.middleware.cors import CORSMiddleware
|
4 |
+
from fastapi.responses import Response
|
5 |
+
import uvicorn
|
6 |
+
from PIL import Image
|
7 |
+
import io
|
8 |
+
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
|