aseifert commited on
Commit
81a15fb
1 Parent(s): 009d248

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -0
app.py CHANGED
@@ -15,6 +15,11 @@ checkpoints = [
15
  ]
16
 
17
 
 
 
 
 
 
18
  @st.cache(suppress_st_warning=True, allow_output_mutation=True)
19
  def get_model(model_name):
20
  return HappyTextToText("T5", model_name)
@@ -45,6 +50,7 @@ def main():
45
  """This writing assistant will proofread any text for you! See my [GitHub repo](https://github.com/aseifert/hf-writing-assistant) for implementation details."""
46
  )
47
 
 
48
  annotator = get_annotator("en")
49
  checkpoint = st.selectbox("Choose model", checkpoints)
50
  model = get_model(checkpoint)
 
15
  ]
16
 
17
 
18
+ def download_spacy_model(model="en"):
19
+ spacy.cli.download(model) # type: ignore
20
+ return True
21
+
22
+
23
  @st.cache(suppress_st_warning=True, allow_output_mutation=True)
24
  def get_model(model_name):
25
  return HappyTextToText("T5", model_name)
 
50
  """This writing assistant will proofread any text for you! See my [GitHub repo](https://github.com/aseifert/hf-writing-assistant) for implementation details."""
51
  )
52
 
53
+ download_spacy_model()
54
  annotator = get_annotator("en")
55
  checkpoint = st.selectbox("Choose model", checkpoints)
56
  model = get_model(checkpoint)