Skip to content

Commit bb2ff08

Browse files
committed
disabled RAW MMIF tab to speed up
1 parent 4f10926 commit bb2ff08

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

app.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ def send_js(path):
9696
def render_mmif(mmif_str, viz_id):
9797
mmif = Mmif(mmif_str)
9898
media = documents_to_htmls(mmif, viz_id)
99+
app.logger.debug(f"Prepared Media: {[m[0] for m in media]}")
99100
annotations = prep_annotations(mmif, viz_id)
100101
app.logger.debug(f"Prepared Annotations: {[annotation[0] for annotation in annotations]}")
101102
return render_template('player.html',
@@ -114,6 +115,7 @@ def upload_file(in_mmif):
114115
os.makedirs(path)
115116
set_last_access(path)
116117
with open(path / 'file.mmif', 'w') as in_mmif_file:
118+
app.logger.debug(f"Writing original MMIF to {path / 'file.mmif'}")
117119
in_mmif_file.write(in_mmif_str)
118120
html_page = render_mmif(in_mmif_str, viz_id)
119121
with open(os.path.join(path, "index.html"), "w") as f:

utils.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,16 +122,22 @@ def get_boxes(mmif):
122122
def prep_annotations(mmif, viz_id):
123123
"""Prepare annotations from the views, and return a list of pairs of tabname
124124
and tab content. The first tab is alway the full MMIF pretty print."""
125-
tabs = [("Info", "<pre>" + create_info(mmif) + "</pre>"),
126-
("MMIF", "<pre>" + mmif.serialize(pretty=True) + "</pre>"),
127-
("Annotations", create_annotation_tables(mmif)),
128-
("Tree", render_interactive_mmif(mmif))]
125+
tabs = []
126+
tabs.append(("Info", "<pre>" + create_info(mmif) + "</pre>"))
127+
app.logger.debug(f"Prepared INFO Tab: {tabs[-1][0]}")
128+
# tabs.append(("MMIF", "<pre>" + mmif.serialize(pretty=True) + "</pre>"))
129+
# app.logger.debug(f"Prepared RAW Tab: {tabs[-1][0]}")
130+
tabs.append(("Annotations", create_annotation_tables(mmif)))
131+
app.logger.debug(f"Prepared SUMMARY Tab: {tabs[-1][0]}")
132+
tabs.append(("Tree", render_interactive_mmif(mmif)))
133+
app.logger.debug(f"Prepared JSTREE Tab: {tabs[-1][0]}")
129134
# TODO: since this uses the same tab-name this will only show the same
130135
# stuff; it does a loop but for now we assume there is just one file with
131136
# alignments (generated by Kaldi)
132137
for fa_view in get_alignment_views(mmif):
133138
vtt_file = asr_alignments_to_vtt(fa_view, viz_id)
134139
tabs.append(("WebVTT", '<pre>' + open(vtt_file).read() + '</pre>'))
140+
app.logger.debug(f"Prepared a VTT Tab: {tabs[-1][0]}")
135141
ner_views = get_ner_views(mmif)
136142
use_id = True if len(ner_views) > 1 else False
137143
for ner_view in ner_views:
@@ -140,6 +146,7 @@ def prep_annotations(mmif, viz_id):
140146
visualization = create_ner_visualization(mmif, ner_view)
141147
tabname = "Entities-%s" % ner_view.id if use_id else "Entities"
142148
tabs.append((tabname, visualization))
149+
app.logger.debug(f"Prepared a displaCy Tab: {tabs[-1][0]}")
143150
# TODO: somewhat hackish
144151
ocr_views = get_ocr_views(mmif)
145152
use_id = True if len(ocr_views) > 1 else False
@@ -149,6 +156,7 @@ def prep_annotations(mmif, viz_id):
149156
tabname = "Thumbnails-%s" % ocr_view.id
150157
visualization = render_template("pre-ocr.html", view_id=ocr_view.id, tabname=tabname, mmif_id=viz_id)
151158
tabs.append((tabname, visualization))
159+
app.logger.debug(f"Prepared a Thumbnails Tab: {tabs[-1][0]}")
152160
return tabs
153161

154162

0 commit comments

Comments
 (0)