Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -27,6 +27,13 @@ CORS(app, resources={r"/send_message": {"origins": ["http://localhost:3000", "ht
|
|
27 |
# Load Sentence-BERT model
|
28 |
bertmodel = SentenceTransformer('all-MiniLM-L6-v2') # Lightweight, efficient model; choose larger if needed
|
29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
# Load model with accelerator
|
31 |
classifier = pipeline(
|
32 |
"zero-shot-classification",
|
@@ -37,13 +44,6 @@ classifier = pipeline(
|
|
37 |
|
38 |
# Move model to correct device
|
39 |
classifier.model = accelerator.prepare(classifier.model)
|
40 |
-
|
41 |
-
# Global variables for model and tokenizer
|
42 |
-
model = None
|
43 |
-
tokenizer = None
|
44 |
-
accelerator = Accelerator()
|
45 |
-
highest_label = None
|
46 |
-
loaded_models = {}
|
47 |
|
48 |
# Define upload directory and FAISS index file
|
49 |
UPLOAD_DIR = "/app/uploads"
|
|
|
27 |
# Load Sentence-BERT model
|
28 |
bertmodel = SentenceTransformer('all-MiniLM-L6-v2') # Lightweight, efficient model; choose larger if needed
|
29 |
|
30 |
+
# Global variables for model and tokenizer
|
31 |
+
model = None
|
32 |
+
tokenizer = None
|
33 |
+
accelerator = Accelerator()
|
34 |
+
highest_label = None
|
35 |
+
loaded_models = {}
|
36 |
+
|
37 |
# Load model with accelerator
|
38 |
classifier = pipeline(
|
39 |
"zero-shot-classification",
|
|
|
44 |
|
45 |
# Move model to correct device
|
46 |
classifier.model = accelerator.prepare(classifier.model)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
# Define upload directory and FAISS index file
|
49 |
UPLOAD_DIR = "/app/uploads"
|