Update app.py
Browse files
app.py
CHANGED
@@ -80,7 +80,7 @@ def process_ner(text: str, pipeline) -> dict:
|
|
80 |
if current_entity is not None:
|
81 |
entities.append(current_entity)
|
82 |
|
83 |
-
return {"entities": entities}
|
84 |
|
85 |
def process_classification(text: str, model1, model2, tokenizer1) -> Tuple[str, str, str]:
|
86 |
inputs1 = tokenizer1(text, max_length=512, return_tensors='pt', truncation=True, padding=True)
|
@@ -95,8 +95,6 @@ def process_classification(text: str, model1, model2, tokenizer1) -> Tuple[str,
|
|
95 |
|
96 |
return f"{round(prediction1, 1)}", f"{round(prediction2, 1)}", f"{round(score, 2)}"
|
97 |
|
98 |
-
import plotly.graph_objects as go
|
99 |
-
from typing import Tuple
|
100 |
|
101 |
def generate_charts(ner_output_bin: dict, ner_output_ext: dict) -> Tuple[go.Figure, go.Figure, np.ndarray]:
|
102 |
entities_bin = [entity['entity'] for entity in ner_output_bin['entities']]
|
|
|
80 |
if current_entity is not None:
|
81 |
entities.append(current_entity)
|
82 |
|
83 |
+
return {"text": text, "entities": entities}
|
84 |
|
85 |
def process_classification(text: str, model1, model2, tokenizer1) -> Tuple[str, str, str]:
|
86 |
inputs1 = tokenizer1(text, max_length=512, return_tensors='pt', truncation=True, padding=True)
|
|
|
95 |
|
96 |
return f"{round(prediction1, 1)}", f"{round(prediction2, 1)}", f"{round(score, 2)}"
|
97 |
|
|
|
|
|
98 |
|
99 |
def generate_charts(ner_output_bin: dict, ner_output_ext: dict) -> Tuple[go.Figure, go.Figure, np.ndarray]:
|
100 |
entities_bin = [entity['entity'] for entity in ner_output_bin['entities']]
|