Update app.py
Browse files
app.py
CHANGED
|
@@ -109,7 +109,6 @@ tokenizer1 = AutoTokenizer.from_pretrained("AlGe/deberta-v3-large_Int_segment",
|
|
| 109 |
|
| 110 |
model2 = AutoModelForSequenceClassification.from_pretrained("AlGe/deberta-v3-large_seq_ext", num_labels=1, token=auth_token)
|
| 111 |
|
| 112 |
-
@spaces.GPU
|
| 113 |
# Define functions to process inputs
|
| 114 |
def process_ner(text, pipeline):
|
| 115 |
output = pipeline(text)
|
|
@@ -150,7 +149,8 @@ def process_classification(text, model1, model2, tokenizer1):
|
|
| 150 |
score = prediction1 / (prediction2 + prediction1)
|
| 151 |
|
| 152 |
return f"{round(prediction1, 1)}", f"{round(prediction2, 1)}", f"{round(score, 2)}"
|
| 153 |
-
|
|
|
|
| 154 |
def all(text):
|
| 155 |
return process_ner(text, pipe_bin), process_ner(text, pipe_ext), process_classification(text, model1, model2, tokenizer1)[0], process_classification(text, model1, model2, tokenizer1)[1], process_classification(text, model1, model2, tokenizer1)[2]
|
| 156 |
|
|
|
|
| 109 |
|
| 110 |
model2 = AutoModelForSequenceClassification.from_pretrained("AlGe/deberta-v3-large_seq_ext", num_labels=1, token=auth_token)
|
| 111 |
|
|
|
|
| 112 |
# Define functions to process inputs
|
| 113 |
def process_ner(text, pipeline):
|
| 114 |
output = pipeline(text)
|
|
|
|
| 149 |
score = prediction1 / (prediction2 + prediction1)
|
| 150 |
|
| 151 |
return f"{round(prediction1, 1)}", f"{round(prediction2, 1)}", f"{round(score, 2)}"
|
| 152 |
+
|
| 153 |
+
@spaces.GPU
|
| 154 |
def all(text):
|
| 155 |
return process_ner(text, pipe_bin), process_ner(text, pipe_ext), process_classification(text, model1, model2, tokenizer1)[0], process_classification(text, model1, model2, tokenizer1)[1], process_classification(text, model1, model2, tokenizer1)[2]
|
| 156 |
|