Spaces:
Sleeping
Sleeping
Commit ·
a3c367f
1
Parent(s): 79b9263
added a cache folder
Browse files
main.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
from fastapi import FastAPI, HTTPException
|
| 2 |
import uvicorn
|
| 3 |
from fastapi.middleware.cors import CORSMiddleware
|
|
@@ -5,9 +6,10 @@ from pydantic import BaseModel
|
|
| 5 |
from sentence_transformers import SentenceTransformer, util
|
| 6 |
|
| 7 |
app = FastAPI()
|
|
|
|
| 8 |
|
| 9 |
# Load the SentenceTransformer model
|
| 10 |
-
model = SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2')
|
| 11 |
|
| 12 |
class StringInput(BaseModel):
|
| 13 |
sentence1: str
|
|
|
|
| 1 |
+
import os
|
| 2 |
from fastapi import FastAPI, HTTPException
|
| 3 |
import uvicorn
|
| 4 |
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
| 6 |
from sentence_transformers import SentenceTransformer, util
|
| 7 |
|
| 8 |
app = FastAPI()
|
| 9 |
+
current_directory = os.getcwd()
|
| 10 |
|
| 11 |
# Load the SentenceTransformer model
|
| 12 |
+
model = SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2',cache_folder =current_directory)
|
| 13 |
|
| 14 |
class StringInput(BaseModel):
|
| 15 |
sentence1: str
|