kinensake commited on
Commit
b0d997e
1 Parent(s): 7bf4d39

Fix: en_core_web_sm

Browse files
Files changed (2) hide show
  1. app.py +6 -0
  2. gramformer/__init__.py +0 -3
app.py CHANGED
@@ -6,6 +6,8 @@ import pandas as pd
6
  import torch
7
  import math
8
  import re
 
 
9
 
10
  def set_seed(seed):
11
  torch.manual_seed(seed)
@@ -13,6 +15,9 @@ def set_seed(seed):
13
  torch.cuda.manual_seed_all(seed)
14
  set_seed(1212)
15
 
 
 
 
16
  class GramformerDemo:
17
 
18
  def __init__(self):
@@ -117,6 +122,7 @@ class GramformerDemo:
117
  st.stop()
118
 
119
  with st.spinner('Loading model..'):
 
120
  gf = self.load_gf(self.model_map[model_type])
121
 
122
  input_text = st.selectbox(
 
6
  import torch
7
  import math
8
  import re
9
+ from multiprocessing import Process
10
+ import os
11
 
12
  def set_seed(seed):
13
  torch.manual_seed(seed)
 
15
  torch.cuda.manual_seed_all(seed)
16
  set_seed(1212)
17
 
18
+ def loadEnModel():
19
+ os.system("python3 -m spacy download en_core_web_sm")
20
+
21
  class GramformerDemo:
22
 
23
  def __init__(self):
 
122
  st.stop()
123
 
124
  with st.spinner('Loading model..'):
125
+ loadEnModel()
126
  gf = self.load_gf(self.model_map[model_type])
127
 
128
  input_text = st.selectbox(
gramformer/__init__.py CHANGED
@@ -1,4 +1 @@
1
- import os
2
- os.system("python3 -m spacy download en_core_web_sm")
3
-
4
  from gramformer.gramformer import Gramformer
 
 
 
 
1
  from gramformer.gramformer import Gramformer