abdiharyadi commited on
Commit
63e7eb5
·
1 Parent(s): c446280

feat: integrate TextToAMR

Browse files
Files changed (2) hide show
  1. app.py +21 -1
  2. requirements.txt +37 -0
app.py CHANGED
@@ -1,8 +1,28 @@
 
1
  import gradio as gr
 
2
  import penman
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
 
4
  def run(text, source_style):
5
- source_amr = penman.decode("(z0 / halo)")
6
  source_amr_display = penman.encode(source_amr)
7
  yield source_amr_display, "...", "...", "...", "..."
8
 
 
1
+ from git import Repo
2
  import gradio as gr
3
+ from huggingface_hub import snapshot_download
4
  import penman
5
+ import sys
6
+
7
+ Repo.clone_from("https://github.com/AbdiHaryadi/amr-tst-indo.git", "amr-tst-indo")
8
+ sys.path.append("./amr-tst-indo")
9
+
10
+ from text_to_amr import TextToAMR
11
+
12
+ # Gold v2
13
+ amr_parsing_model_name = "mbart-en-id-smaller-indo-amr-parsing-translated-nafkhan"
14
+ snapshot_download(
15
+ repo_id=f"abdiharyadi/{amr_parsing_model_name}",
16
+ local_dir=f"./amr-tst-indo/AMRBART-id/models/{amr_parsing_model_name}",
17
+ ignore_patterns=[
18
+ "*log*",
19
+ "*checkpoint*",
20
+ ]
21
+ )
22
+ t2a = TextToAMR(model_name=amr_parsing_model_name)
23
 
24
  def run(text, source_style):
25
+ source_amr, *_ = t2a([text])
26
  source_amr_display = penman.encode(source_amr)
27
  yield source_amr_display, "...", "...", "...", "..."
28
 
requirements.txt CHANGED
@@ -1 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  Penman==1.3.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ gitpython
2
+
3
+ accelerate==0.32.1
4
+ amrlib==0.8.0
5
+ cached-property==1.5.2
6
+ ConfigArgParse==1.7
7
+ datasets==2.20.0
8
+ editdistance==0.8.1
9
+ evaluate==0.4.3
10
+ fasttext==0.9.3
11
+ h5py-cache==1.0
12
+ networkx==3.3
13
+ nltk==3.8.1
14
+ pandas==2.2.2
15
  Penman==1.3.0
16
+ pytorch-ignite==0.5.0.post2
17
+ PyYAML==6.0.1
18
+ regex==2024.5.15
19
+ rouge_score==0.1.2
20
+ sacrebleu==2.4.2
21
+ sacremoses==0.1.1
22
+ Sastrawi==1.0.1
23
+ sentence-transformers==3.0.1
24
+ sentencepiece==0.2.0
25
+ smatch==1.0.4
26
+ tensorboardX==2.6.2.2
27
+ torch==2.4.0 --index-url https://download.pytorch.org/whl/cu121
28
+ torchmetrics==1.4.0.post0
29
+ tqdm==4.66.4
30
+ transformers==4.44.0
31
+ wandb==0.17.5
32
+
33
+ # This library depends on what system you use, and doesn't impact the result.
34
+ numpy
35
+ torchvision --index-url https://download.pytorch.org/whl/cu121
36
+
37
+ # This library version should be fixed until Indonesian stanza doesn't have any hash problem.
38
+ stanza==1.4.2