osanseviero HF staff commited on
Commit
73df8ac
1 Parent(s): 425b725

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -1
app.py CHANGED
@@ -4,11 +4,21 @@ import srsly
4
  import importlib
5
  import random
6
 
7
- MODELS = srsly.read_json(Path(__file__).parent / "models.json")
8
  DEFAULT_MODEL = "en_core_web_sm"
9
  DEFAULT_TEXT = "David Bowie moved to the US in 1974, initially staying in New York City before settling in Los Angeles."
10
  DESCRIPTION = """**Explore trained [spaCy v3.1](https://nightly.spacy.io) pipelines**"""
11
 
 
 
 
 
 
 
 
 
 
 
 
12
  def get_default_text(nlp):
13
  # Check if spaCy has built-in example texts for the language
14
  try:
4
  import importlib
5
  import random
6
 
 
7
  DEFAULT_MODEL = "en_core_web_sm"
8
  DEFAULT_TEXT = "David Bowie moved to the US in 1974, initially staying in New York City before settling in Los Angeles."
9
  DESCRIPTION = """**Explore trained [spaCy v3.1](https://nightly.spacy.io) pipelines**"""
10
 
11
+ def get_all_models():
12
+ with open("requirements.txt") as f:
13
+ content = f.readlines()
14
+ models = []
15
+ for line in content:
16
+ if "huggingface.co" in line:
17
+ models.append(line.split("/")[4])
18
+ return models
19
+
20
+ MODELS = get_all_models()
21
+
22
  def get_default_text(nlp):
23
  # Check if spaCy has built-in example texts for the language
24
  try: