imseldrith commited on
Commit
137a655
·
1 Parent(s): 106fec8

Update templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +27 -49
templates/index.html CHANGED
@@ -1,56 +1,34 @@
1
- <html<html>
2
  <head>
3
- <title>Paraphrasing Webapp</title>
4
- <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
5
- <script src="https://cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js"></script>
6
- <script type="text/javascript">
7
- $(document).ready(function(){
8
- var clipboard = new ClipboardJS('.copy-btn');
9
- clipboard.on('success', function(e) {
10
- alert("Paraphrased Text Copied to Clipboard!");
11
  });
12
- clipboard.on('error', function(e) {
13
- alert("Unable to Copy. Please try again.");
14
- });
15
- $('#correct-grammar').click(function(){
16
- $.post("/correct_grammar", {text: $('#input-text').val()}, function(data){
17
- $('#input-text').val(data.corrected_text);
18
- });
19
- });
20
- $('#remove-special-characters').click(function(){
21
- $.post("/remove_special_characters", {text: $('#input-text').val()}, function(data){
22
- $('#input-text').val(data.filtered_text);
23
- });
24
- });
25
- $('#paraphrase').click(function(){
26
- $.post("/paraphrase", {text: $('#input-text').val()}, function(data){
27
- $('#output-text').val(data.paraphrased_text);
28
- });
29
- });
30
- $('#summarize').click(function(){
31
- $.post("/summarize", {text: $('#input-text').val()}, function(data){
32
- $('#output-text').val(data.summarized_text);
33
- });
34
- });
35
- $('#detect-emotion').click(function(){
36
- $.post("/detect_emotion", {text: $('#input-text').val()}, function(data){
37
- alert("Detected Emotion: " + data.emotion);
38
- });
39
- });
40
- });
41
  </script>
42
  </head>
43
  <body>
44
- <h1>Paraphrasing Webapp</h1>
45
- <label for="input-text">Input Text:</label>
46
- <textarea id="input-text"></textarea><br><br>
47
- <button id="correct-grammar">Correct Grammar</button>
48
- <button id="remove-special-characters">Remove Special Characters</button><br><br>
49
- <label for="output-text">Output Text:</label>
50
- <textarea id="output-text"></textarea><br><br>
51
- <button id="paraphrase">Paraphrase</button>
52
- <button id="summarize">Summarize</button>
53
- <button id="detect-emotion">Detect Emotion</button><br><br>
54
- <button class="copy-btn" data-clipboard-target="#output-text">Copy Paraphrased Text</button>
 
 
 
 
 
 
55
  </body>
56
  </html>
 
1
+ <html>
2
  <head>
3
+ <title>Paraphraser Webapp</title>
4
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
5
+ <script>
6
+ function copyText(text) {
7
+ navigator.clipboard.writeText(text).then(function() {
8
+ console.log('Text copied to clipboard');
9
+ }, function(err) {
10
+ console.error('Could not copy text: ', err);
11
  });
12
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  </script>
14
  </head>
15
  <body>
16
+ <h1>Paraphraser Webapp</h1>
17
+ <form action="/" method="post">
18
+ <textarea name="input_text" rows="10" cols="30"></textarea>
19
+ <br><br>
20
+ <input type="checkbox" name="options" value="remove_special_characters">Remove special characters<br>
21
+ <input type="checkbox" name="options" value="correct_grammar">Correct grammar<br>
22
+ <input type="checkbox" name="options" value="summarize">Summarize<br>
23
+ <input type="checkbox" name="options" value="adjust_tone">Adjust tone<br>
24
+ <br>
25
+ <input type="submit" value="Paraphrase">
26
+ </form>
27
+ {% if result %}
28
+ <p>Paraphrased text:</p>
29
+ <textarea rows="10" cols="30">{{ result }}</textarea>
30
+ <br><br>
31
+ <button onclick="copyText()">Copy to Clipboard</button>
32
+ {% endif %}
33
  </body>
34
  </html>