sasha HF staff commited on
Commit
3801f61
1 Parent(s): c62d033

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -59,9 +59,18 @@ eval = evaluator("text-classification")
59
 
60
  ### Loading models
61
 
 
62
  for i in range (len(models)):
 
 
 
 
 
 
 
 
63
  globals()[f"pipe_{i}"] = pipeline("text-classification", model = models[i], tokenizer = models[i], device=-1)
64
- st.text("Loaded model "+ str(models[i]))
65
 
66
  ### Defining metrics
67
  for i in range (len(metrics)):
 
59
 
60
  ### Loading models
61
 
62
+ model_list=[]
63
  for i in range (len(models)):
64
+ try:
65
+ globals()[f"tokenizer_{i}"] = AutoTokenizer.from_pretrained(models[i])
66
+ globals()[f"model_{i}"] = AutoModelForSequenceClassification.from_pretrained(models[i])
67
+ model_list.append(models[i])
68
+ except:
69
+ print("Sorry, I can't load model "+ str(models[i]))
70
+
71
+ for i in range (len(model_list)):
72
  globals()[f"pipe_{i}"] = pipeline("text-classification", model = models[i], tokenizer = models[i], device=-1)
73
+ st.text("Loaded pipeline "+ str(models[i]))
74
 
75
  ### Defining metrics
76
  for i in range (len(metrics)):