sasha HF staff commited on
Commit
8e0fe7a
1 Parent(s): 0622968

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -54,7 +54,6 @@ st.markdown("### Please wait for the dataset and models to load (this can take s
54
  @st.cache
55
  def loaddset(d, d_split):
56
  data = datasets.load_dataset(d, split=d_split)
57
- st.text("Loaded the "+ str(d_split)+ " split of dataset "+ str(d))
58
  return(data)
59
 
60
  data = loaddset(dset,dset_split)
@@ -72,17 +71,18 @@ def load_models(mod_names):
72
  globals()[f"model_{i}"] = AutoModelForSequenceClassification.from_pretrained(mod_names[i])
73
  model_list.append(mod_names[i])
74
  except:
75
- print("Sorry, I can't load model "+ str(mod_names[i]))
76
- return("Loaded "+ str(len(model_list))+ " models")
77
 
78
  load_models(models)
79
 
80
  @st.cache
81
  def load_pipes(mod_list):
 
82
  for i in range (len(mod_list)):
83
  globals()[f"pipe_{i}"] = pipeline("text-classification", model = models[i], tokenizer = models[i], device=-1)
84
- st.text("Loaded pipeline "+ str(models[i]))
85
- return("Loaded "+ str(len(mod_list))+ " models")
86
 
87
  load_pipes(model_list)
88
 
 
54
  @st.cache
55
  def loaddset(d, d_split):
56
  data = datasets.load_dataset(d, split=d_split)
 
57
  return(data)
58
 
59
  data = loaddset(dset,dset_split)
 
71
  globals()[f"model_{i}"] = AutoModelForSequenceClassification.from_pretrained(mod_names[i])
72
  model_list.append(mod_names[i])
73
  except:
74
+ continue
75
+ return(model_list)
76
 
77
  load_models(models)
78
 
79
  @st.cache
80
  def load_pipes(mod_list):
81
+ pipe_list=[]
82
  for i in range (len(mod_list)):
83
  globals()[f"pipe_{i}"] = pipeline("text-classification", model = models[i], tokenizer = models[i], device=-1)
84
+
85
+ return(pipe_list)
86
 
87
  load_pipes(model_list)
88