salma-remyx commited on
Commit
3ffd673
1 Parent(s): 740c6a9

en_core_web_sm download

Browse files
Files changed (2) hide show
  1. app.py +7 -1
  2. setup.sh +0 -2
app.py CHANGED
@@ -16,7 +16,13 @@ import depth_pro
16
  import spacy
17
  import gradio as gr
18
 
19
- nlp = spacy.load("en_core_web_sm")
 
 
 
 
 
 
20
 
21
  def find_subject(doc):
22
  for token in doc:
 
16
  import spacy
17
  import gradio as gr
18
 
19
+ try:
20
+ nlp = spacy.load("en_core_web_sm")
21
+ except OSError:
22
+ # Download the model if it's not already available
23
+ from spacy.cli import download
24
+ download("en_core_web_sm")
25
+ nlp = spacy.load("en_core_web_sm")
26
 
27
  def find_subject(doc):
28
  for token in doc:
setup.sh DELETED
@@ -1,2 +0,0 @@
1
- #!/bin/bash
2
- python3 -m spacy download en_core_web_sm