Update app.py
Browse files
app.py
CHANGED
@@ -15,6 +15,17 @@ import subprocess
|
|
15 |
import time
|
16 |
import uuid
|
17 |
from threading import Timer
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
from flask import Flask, render_template, request, url_for, send_from_directory
|
20 |
from google import genai
|
|
|
15 |
import time
|
16 |
import uuid
|
17 |
from threading import Timer
|
18 |
+
import spacy
|
19 |
+
|
20 |
+
try:
|
21 |
+
# Try loading the model by its shortcut name
|
22 |
+
nlp = spacy.load("en_core_web_sm")
|
23 |
+
except OSError:
|
24 |
+
# If the model is not found, download and link it programmatically.
|
25 |
+
from spacy.cli import download, link
|
26 |
+
download("en_core_web_sm") # Download the model
|
27 |
+
link("en_core_web_sm", "en_core_web_sm") # Create the symlink
|
28 |
+
nlp = spacy.load("en_core_web_sm")
|
29 |
|
30 |
from flask import Flask, render_template, request, url_for, send_from_directory
|
31 |
from google import genai
|