Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -24,8 +24,27 @@ if not os.path.exists(MODEL_DIR) or not os.listdir(MODEL_DIR):
|
|
| 24 |
local_dir_use_symlinks=False
|
| 25 |
)
|
| 26 |
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
from sinatools.relations.relation_extractor import relation_extraction
|
| 30 |
from sinatools.relations.event_relation_extractor import event_argument_relation_extraction
|
| 31 |
|
|
|
|
| 24 |
local_dir_use_symlinks=False
|
| 25 |
)
|
| 26 |
|
| 27 |
+
|
| 28 |
+
pretrained_path = "aubmindlab/bert-base-arabertv2" # must match training
|
| 29 |
+
tokenizer = AutoTokenizer.from_pretrained(pretrained_path)
|
| 30 |
+
encoder = AutoModel.from_pretrained(pretrained_path).eval()
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
checkpoint_path = snapshot_download(repo_id="SinaLab/Nested", allow_patterns="checkpoints/")
|
| 34 |
+
|
| 35 |
+
args_path = hf_hub_download(
|
| 36 |
+
repo_id="SinaLab/Nested",
|
| 37 |
+
filename="args.json"
|
| 38 |
+
)
|
| 39 |
+
|
| 40 |
+
with open(args_path, 'r') as f:
|
| 41 |
+
args_data = json.load(f)
|
| 42 |
|
| 43 |
+
# Load model
|
| 44 |
+
with open("Nested/utils/tag_vocab.pkl", "rb") as f:
|
| 45 |
+
label_vocab = pickle.load(f)
|
| 46 |
+
|
| 47 |
+
|
| 48 |
from sinatools.relations.relation_extractor import relation_extraction
|
| 49 |
from sinatools.relations.event_relation_extractor import event_argument_relation_extraction
|
| 50 |
|