Spaces:
Sleeping
Sleeping
Update app.py
Browse filesupdated absolute file path for google_categories(v2).txt
app.py
CHANGED
|
@@ -19,6 +19,11 @@ from gliner_spacy.pipeline import GlinerSpacy
|
|
| 19 |
import warnings
|
| 20 |
import threading
|
| 21 |
warnings.filterwarnings("ignore", message="The sentencepiece tokenizer")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
# Configuration for GLiNER integration
|
| 24 |
custom_spacy_config = {
|
|
@@ -67,7 +72,7 @@ def extract_entities(text):
|
|
| 67 |
return entities if entities else ["No specific entities found"]
|
| 68 |
|
| 69 |
# Load Google's content categories
|
| 70 |
-
with open(
|
| 71 |
google_categories = [line.strip() for line in f]
|
| 72 |
|
| 73 |
# Function to precompute category embeddings
|
|
|
|
| 19 |
import warnings
|
| 20 |
import threading
|
| 21 |
warnings.filterwarnings("ignore", message="The sentencepiece tokenizer")
|
| 22 |
+
import os
|
| 23 |
+
|
| 24 |
+
# At the top of your script, after imports
|
| 25 |
+
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
| 26 |
+
CATEGORIES_FILE = os.path.join(BASE_DIR, 'google_categories(v2).txt')
|
| 27 |
|
| 28 |
# Configuration for GLiNER integration
|
| 29 |
custom_spacy_config = {
|
|
|
|
| 72 |
return entities if entities else ["No specific entities found"]
|
| 73 |
|
| 74 |
# Load Google's content categories
|
| 75 |
+
with open(CATEGORIES_FILE, 'r') as f:
|
| 76 |
google_categories = [line.strip() for line in f]
|
| 77 |
|
| 78 |
# Function to precompute category embeddings
|