Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -131,7 +131,7 @@ def main():
|
|
131 |
|
132 |
model = AutoModelForSequenceClassification.from_pretrained(model_path,id2label={0:'non-causal',1:'causal'})
|
133 |
|
134 |
-
st.write('sequence classification loaded')
|
135 |
pipe1 = pipeline("text-classification", model=model,tokenizer=tokenizer)
|
136 |
for sent in result:
|
137 |
pred = pipe1(sent)
|
@@ -139,7 +139,7 @@ def main():
|
|
139 |
if lab['label'] == 'causal': #causal
|
140 |
causal_sents.append(sent)
|
141 |
|
142 |
-
st.write('causal sentence classification finished')
|
143 |
# st.write("--- %s seconds ---" % (time.time() - start_time))
|
144 |
|
145 |
model_name = "distilbert-base-cased"
|
@@ -149,7 +149,7 @@ def main():
|
|
149 |
|
150 |
model = DistilBertForTokenClassification.from_pretrained(model_path1,low_cpu_mem_usage=True) #len(unique_tags),, num_labels= 7, , id2label={0:'CT',1:'E',2:'C',3:'O'}
|
151 |
pipe = pipeline('ner', model=model, tokenizer=tokenizer,aggregation_strategy='simple') #grouped_entities=True
|
152 |
-
st.write('DistilBERT loaded')
|
153 |
sentence_pred = []
|
154 |
class_list = []
|
155 |
entity_list = []
|
|
|
131 |
|
132 |
model = AutoModelForSequenceClassification.from_pretrained(model_path,id2label={0:'non-causal',1:'causal'})
|
133 |
|
134 |
+
#st.write('sequence classification loaded')
|
135 |
pipe1 = pipeline("text-classification", model=model,tokenizer=tokenizer)
|
136 |
for sent in result:
|
137 |
pred = pipe1(sent)
|
|
|
139 |
if lab['label'] == 'causal': #causal
|
140 |
causal_sents.append(sent)
|
141 |
|
142 |
+
#st.write('causal sentence classification finished')
|
143 |
# st.write("--- %s seconds ---" % (time.time() - start_time))
|
144 |
|
145 |
model_name = "distilbert-base-cased"
|
|
|
149 |
|
150 |
model = DistilBertForTokenClassification.from_pretrained(model_path1,low_cpu_mem_usage=True) #len(unique_tags),, num_labels= 7, , id2label={0:'CT',1:'E',2:'C',3:'O'}
|
151 |
pipe = pipeline('ner', model=model, tokenizer=tokenizer,aggregation_strategy='simple') #grouped_entities=True
|
152 |
+
#st.write('DistilBERT loaded')
|
153 |
sentence_pred = []
|
154 |
class_list = []
|
155 |
entity_list = []
|