-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo copy 2.html
611 lines (561 loc) · 23.4 KB
/
demo copy 2.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
<!doctype html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Argument Mining Framework Demo</title>
<link rel="stylesheet" href="/amf/assets/css/style.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<style>
/* General Styling */
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
color: #333;
background-color: #ebeef1;
}
header {
background-color: #007bff;
color: white;
padding: 20px;
text-align: center;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
header h1 {
margin: 0;
font-size: 2.5em;
}
header p {
margin: 0;
font-size: 1.2em;
}
footer {
padding: 20px;
text-align: left;
margin-left: -50%; /* Negative margin to move it further left */
width: calc(100% + 20px); /* Adjust width to compensate for negative margin */
}
footer a {
color: #17a2b8;
text-decoration: none;
}
footer a:hover {
text-decoration: underline;
}
/* Wrapper */
.wrapper {
display: flex;
flex-direction: column;
margin: 0 auto;
max-width: 1200px;
padding: 20px;
}
.main-content {
flex: 2;
margin-right: 20px;
margin-left: -35%; /* This moves the content 5% to the left */
}
.right-sidebar {
flex: 1;
padding-left: 20px;
border-left: 1px solid #ddd;
margin-top: 190px; /* Push the sidebar further down */
}
@media (min-width: 768px) {
.wrapper {
flex-direction: row;
}
}
/* Tabs Styling */
.tab {
overflow: hidden;
border-bottom: 1px solid #ddd;
background-color: #fff;
margin-bottom: 20px;
}
.tab button {
background-color: #f1f1f1;
float: left;
border: none;
outline: none;
cursor: pointer;
padding: 14px 20px;
transition: 0.3s;
font-size: 16px;
border-bottom: 3px solid transparent;
}
.tab button:hover, .tab button.active {
background-color: #ddd;
border-bottom: 3px solid #007bff;
}
.tab-content {
background-color: #fff;
padding: 20px;
border: 1px solid #ddd;
border-radius: 4px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
display: none; /* Hide all content by default */
}
.tab-content.active {
display: block; /* Show the active content */
}
/* Forms */
.form-container {
margin-top: 20px;
}
.form-container input[type="file"], .form-container select, .form-container input[type="text"] {
margin: 10px 0;
padding: 12px;
border: 1px solid #ccc;
border-radius: 6px;
width: 100%;
background-color: #f9f9f9;
}
.form-container button {
padding: 12px;
background-color: #007bff; /* Blue color */
color: white;
border: none;
border-radius: 6px;
cursor: pointer;
width: 100%;
margin: 10px 0;
transition: background-color 0.3s ease;
}
.form-container button:hover {
background-color: #0056b3; /* Darker blue */
}
.result {
display: flex;
background-color: #e9ecef;
padding: 15px;
border: 1px solid #ced4da;
border-radius: 6px;
white-space: pre-wrap;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
gap: 20px; /* Space between the two divs */
}
.output-container {
flex: 1;
border: 1px solid #ccc; /* Border to distinguish between outputs */
padding: 10px;
overflow: auto; /* Enable scrolling if content overflows */
}
#json-output {
white-space: pre-wrap; /* Preserve whitespace for JSON formatting */
}
h3 {
margin-top: 0;
color: #333;
}
/* Pipeline Builder */
.pipeline-builder {
margin-top: 20px;
background-color: #fff;
padding: 20px;
border: 1px solid #ddd;
border-radius: 6px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
.pipeline-builder select, .pipeline-builder input[type="file"] {
margin-right: 10px;
}
.pipeline-builder button {
margin-top: 10px;
background-color: #007bff; /* Blue color */
}
.pipeline-builder button:hover {
background-color: #0056b3; /* Darker blue */
}
/* Twitter Feed */
.twitter-feed {
border: 1px solid #ddd;
border-radius: 6px;
overflow: hidden;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
</style>
</head>
<body>
<header>
<h1>Argument Mining Framework Demo</h1>
<p>Test and explore various modules and the pipeline here.</p>
</header>
<div class="wrapper">
<!-- Main Content Area -->
<div class="main-content">
<section>
<div class="tab">
<button class="tablinks" onclick="openTab(event, 'Turninator')">Turninator</button>
<button class="tablinks" onclick="openTab(event, 'Segmenter')">Segmenter</button>
<button class="tablinks" onclick="openTab(event, 'Propositionalizer')">Propositionalizer</button>
<button class="tablinks" onclick="openTab(event, 'ArgumentRelation')">Argument Relation</button>
<button class="tablinks" onclick="openTab(event, 'Hypothesis')">Hypothesis</button>
<button class="tablinks" onclick="openTab(event, 'Scheme')">Scheme</button>
<button class="tablinks" onclick="openTab(event, 'Visualizer')">Visualizer</button>
</div>
<!-- Tab Content -->
<div id="Turninator" class="tab-content active">
<h2>Turninator</h2>
<p>The Turninator module analyzes text to identify argumentative turns. Upload your file to start processing.</p>
<div class="form-container">
<input type="file" id="turninator-input" />
<button type="button" onclick="runTurninator()">Run Turninator</button>
<div id="turninator-result" class="result">
<div id="json-container" class="output-container" onclick="toggleJson()">
<h3>JSON Output</h3>
<div id="json-output"></div>
</div>
<div id="svg-container" class="output-container">
<h3>SVG Output</h3>
<div id="svg-output"></div>
</div>
</div>
</div>
</div>
<div id="Segmenter" class="tab-content">
<h2>Segmenter</h2>
<p>The Segmenter module divides text into meaningful argumentative units for further analysis. Upload your file to begin.</p>
<div class="form-container">
<input type="file" id="segmenter-input" />
<button type="button" onclick="runSegmenter()">Run Segmenter</button>
<div id="segmenter-result" class="result">
<div id="json-container" class="output-container" onclick="toggleJson()">
<h3>JSON Output</h3>
<div id="json-output"></div>
</div>
<div id="svg-container" class="output-container">
<h3>SVG Output</h3>
<div id="svg-output"></div>
</div>
</div>
</div>
</div>
<div id="Propositionalizer" class="tab-content">
<h2>Propositionalizer</h2>
<p>The Propositionalizer module converts argumentative units into propositions. Upload your file to get started.</p>
<div class="form-container">
<input type="file" id="propositionalizer-input" />
<button type="button" onclick="runPropositionalizer()">Run Propositionalizer</button>
<div id="propositionalizer-result" class="result"></div>
</div>
</div>
<div id="ArgumentRelation" class="tab-content">
<h2>Argument Relation</h2>
<p>The Argument Relation module identifies argument relation between argument units. Upload your file to analyze.</p>
<div class="form-container">
<input type="file" id="argument-relation-input" />
<button type="button" onclick="runArgumentRelation()">Run Argument Relation</button>
<div id="argument-relation-result" class="result"></div>
</div>
</div>
<div id="Hypothesis" class="tab-content">
<h2>Hypothesis</h2>
<p>The Hypothesis module identifies hypotheses within argumentative text. Upload your file to process.</p>
<div class="form-container">
<input type="file" id="hypothesis-input" />
<button type="button" onclick="runHypothesis()">Run Hypothesis</button>
<div id="hypothesis-result" class="result"></div>
</div>
</div>
<div id="Scheme" class="tab-content">
<h2>Scheme</h2>
<p>The Scheme module extracts argumentative schemes from the text. Upload your file to begin extraction.</p>
<div class="form-container">
<input type="file" id="scheme-input" />
<button type="button" onclick="runScheme()">Run Scheme</button>
<div id="scheme-result" class="result"></div>
</div>
</div>
<div id="Visualizer" class="tab-content">
<h2>Visualizer</h2>
<p>The Visualizer module provides a visual representation of the argument structure. Upload your file to visualize.</p>
<div class="form-container">
<input type="file" id="visualizer-input" />
<button type="button" onclick="runVisualizer()">Run Visualizer</button>
<div id="visualizer-result" class="result"></div>
</div>
</div>
</section>
<!-- Pipeline Builder -->
<div class="pipeline-builder">
<h2>Pipeline Builder</h2>
<p>Select modules to add to your pipeline:</p>
<form id="pipeline-form">
<select id="module-select">
<option value="Turninator">Turninator</option>
<option value="Segmenter">Segmenter</option>
<option value="Propositionalizer">Propositionalizer</option>
<option value="ArgumentRelation">Argument Relation</option>
<option value="Hypothesis">Hypothesis</option>
<option value="Scheme">Scheme</option>
<option value="Visualizer">Visualizer</option>
</select>
<button type="button" onclick="addToPipeline()">Add to Pipeline</button>
<button type="button" onclick="runPipeline()">Run Pipeline</button>
</form>
<h3>Current Pipeline:</h3>
<ul id="pipeline-list">
<!-- Pipeline modules will be listed here -->
</ul>
</div>
</div>
<!-- Right Sidebar -->
<div class="right-sidebar">
<div class="twitter-feed">
<h2>Latest Updates</h2>
<a class="twitter-timeline" data-width="400" data-height="900" data-theme="light" href="https://twitter.com/ARG_tech?ref_src=twsrc%5Etfw">Tweets by ARG_tech</a> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
</div>
</div>
</div>
<script>
function fetchSvg(jsonData) {
$.ajax({
url: 'http://svg.amfws.arg.tech',
type: 'POST',
contentType: 'application/json',
data: JSON.stringify(jsonData),
success: function(svgResponse) {
var svgOutput = document.getElementById('svg-output');
svgOutput.innerHTML = svgResponse;
svgOutput.style.display = 'block'; // Show SVG by default
},
error: function(xhr, status, error) {
console.error('Error fetching SVG:', error);
}
});
}
function toggleJson() {
var jsonContainer = document.getElementById('json-container');
var svgContainer = document.getElementById('svg-container');
// Toggle JSON container visibility
if (jsonContainer.style.display === 'none' || jsonContainer.style.display === '') {
jsonContainer.style.display = 'block';
} else {
jsonContainer.style.display = 'none';
}
// SVG container remains visible or hides based on the same logic if needed
}
function openTab(evt, tabName) {
var i, tabcontent, tablinks;
tabcontent = document.getElementsByClassName("tab-content");
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].className = tabcontent[i].className.replace(" active", "");
}
tablinks = document.getElementsByClassName("tablinks");
for (i = 0; i < tablinks.length; i++) {
tablinks[i].className = tablinks[i].className.replace(" active", "");
}
document.getElementById(tabName).className += " active";
evt.currentTarget.className += " active";
}
function runTurninator() {
var fileInput = document.getElementById('turninator-input');
var resultDiv = document.getElementById('turninator-result');
if (fileInput.files.length === 0) {
resultDiv.textContent = 'Please upload a file.';
return;
}
var formData = new FormData();
formData.append("file", fileInput.files[0]);
$.ajax({
url: 'https://default-turninator.amfws.arg.tech/turninator-01',
type: 'POST',
data: formData,
contentType: false,
processData: false,
success: function(response) {
var jsonString = JSON.stringify(response, null, 2);
// Display JSON result
var jsonOutput = document.getElementById('json-output');
jsonOutput.textContent = jsonString;
jsonOutput.style.display = 'block'; // Show JSON by default
// Fetch SVG result
fetchSvg(response);
},
error: function() {
resultDiv.textContent = 'Error processing the file.';
}
});
}
function runSegmenter() {
var fileInput = document.getElementById('segmenter-input');
var resultDiv = document.getElementById('segmenter-result');
if (fileInput.files.length === 0) {
resultDiv.textContent = 'Please upload a file.';
return;
}
var formData = new FormData();
formData.append("file", fileInput.files[0]);
$.ajax({
url: 'https://default-segmenter.amfws.arg.tech/segmenter-01',
type: 'POST',
data: formData,
contentType: false,
processData: false,
success: function(response) {
var jsonString = JSON.stringify(response, null, 2);
// Display JSON result
var jsonOutput = document.getElementById('json-output');
jsonOutput.textContent = jsonString;
jsonOutput.style.display = 'block'; // Show JSON by default
// Fetch SVG result
fetchSvg(response);
},
error: function() {
resultDiv.textContent = 'Error processing the file.';
}
});
}
function runPropositionalizer() {
var fileInput = document.getElementById('propositionalizer-input');
var resultDiv = document.getElementById('propositionalizer-result');
if (fileInput.files.length === 0) {
resultDiv.textContent = 'Please upload a file.';
return;
}
var formData = new FormData();
formData.append("file", fileInput.files[0]);
$.ajax({
url: '/amf/api/propositionalizer',
type: 'POST',
data: formData,
contentType: false,
processData: false,
success: function(response) {
resultDiv.textContent = response;
},
error: function() {
resultDiv.textContent = 'Error processing the file.';
}
});
}
function runArgumentRelation() {
var fileInput = document.getElementById('argument-relation-input');
var resultDiv = document.getElementById('argument-relation-result');
if (fileInput.files.length === 0) {
resultDiv.textContent = 'Please upload a file.';
return;
}
var formData = new FormData();
formData.append("file", fileInput.files[0]);
$.ajax({
url: '/amf/api/argument-relation',
type: 'POST',
data: formData,
contentType: false,
processData: false,
success: function(response) {
resultDiv.textContent = response;
},
error: function() {
resultDiv.textContent = 'Error processing the file.';
}
});
}
function runHypothesis() {
var fileInput = document.getElementById('hypothesis-input');
var resultDiv = document.getElementById('hypothesis-result');
if (fileInput.files.length === 0) {
resultDiv.textContent = 'Please upload a file.';
return;
}
var formData = new FormData();
formData.append("file", fileInput.files[0]);
$.ajax({
url: '/amf/api/hypothesis',
type: 'POST',
data: formData,
contentType: false,
processData: false,
success: function(response) {
resultDiv.textContent = response;
},
error: function() {
resultDiv.textContent = 'Error processing the file.';
}
});
}
function runScheme() {
var fileInput = document.getElementById('scheme-input');
var resultDiv = document.getElementById('scheme-result');
if (fileInput.files.length === 0) {
resultDiv.textContent = 'Please upload a file.';
return;
}
var formData = new FormData();
formData.append("file", fileInput.files[0]);
$.ajax({
url: '/amf/api/scheme',
type: 'POST',
data: formData,
contentType: false,
processData: false,
success: function(response) {
resultDiv.textContent = response;
},
error: function() {
resultDiv.textContent = 'Error processing the file.';
}
});
}
function runVisualizer() {
var fileInput = document.getElementById('visualizer-input');
var resultDiv = document.getElementById('visualizer-result');
if (fileInput.files.length === 0) {
resultDiv.textContent = 'Please upload a file.';
return;
}
var formData = new FormData();
formData.append("file", fileInput.files[0]);
$.ajax({
url: '/amf/api/visualizer',
type: 'POST',
data: formData,
contentType: false,
processData: false,
success: function(response) {
resultDiv.textContent = response;
},
error: function() {
resultDiv.textContent = 'Error processing the file.';
}
});
}
function addToPipeline() {
var select = document.getElementById('module-select');
var selectedModule = select.value;
var pipelineList = document.getElementById('pipeline-list');
var listItem = document.createElement('li');
listItem.textContent = selectedModule;
pipelineList.appendChild(listItem);
}
function runPipeline() {
var pipelineList = document.getElementById('pipeline-list');
var modules = [];
for (var i = 0; i < pipelineList.children.length; i++) {
modules.push(pipelineList.children[i].textContent);
}
if (modules.length === 0) {
alert('Please add at least one module to the pipeline.');
return;
}
console.log('Modules to be sent:', modules);
$.ajax({
url: '/amf/api/run-pipeline',
type: 'POST',
data: JSON.stringify({ modules: modules }),
contentType: 'application/json',
success: function(response) {
alert('Pipeline executed successfully!');
},
error: function() {
alert('Error executing the pipeline.');
}
});
}
</script>
</body>
</html>