Spaces:
Runtime error
Runtime error
| <head> | |
| <title>Language Translation</title> | |
| <link rel="stylesheet" href="{{ url_for('static', filename='Translation.css') }}"> | |
| <!-- Bootstrap CSS --> | |
| <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-KK94CHFLLe+nY2dmCWGMq91rCGa5gtU4mk92HdvYe+M/SXH301p5ILy+dN9+nJOZ" crossorigin="anonymous"> | |
| </head> | |
| <body> | |
| <!-- Navigation bar; To go to different pages without having to go back to index/home page --> | |
| <nav class="navbar navbar-expand-lg bg-body-tertiary"> | |
| <div class="container-fluid"> | |
| <a class="navbar-brand" href="{{ url_for('index') }}">Home</a> | |
| <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation"> | |
| <span class="navbar-toggler-icon"></span> | |
| </button> | |
| <div class="collapse navbar-collapse" id="navbarNavAltMarkup"> | |
| <div class="navbar-nav"> | |
| <a class="nav-link active" href="{{ url_for('text_summarization') }}">Summarization</a> | |
| <a class="nav-link" href="{{ url_for('project_breakdown') }}">Task Breakdown</a> | |
| <a class="nav-link" aria-current="page" href="{{ url_for('language_translation') }}">Translation</a> | |
| <a class="nav-link" href="{{ url_for('text_generation') }}">Generation</a> | |
| </div> | |
| </div> | |
| </div> | |
| </nav> | |
| <div class="k"> | |
| <img src="{{ url_for('static', filename='Images/Refineverse logo.png') }}" alt="Refineverse Logo"> | |
| <div class="kk"> | |
| <h1>Language Translation</h1> | |
| <h5>Machine Translation for your desired choice of language.</h5> | |
| </div> | |
| </div> | |
| <form action="#" method="POST"> | |
| <!-- Drop-down box for source language. --> | |
| <label for="source_language" id="source">Choose your source language:</label> | |
| <select id="language" name="source_language"> | |
| <option value="en" selected>English</option> | |
| <option value="zh">Chinese</option> | |
| <option value="ms">Malay</option> | |
| <option value="ta">Tamil</option> | |
| <option value="th">Thai</option> | |
| </select> | |
| <!-- Drop-down box for target language. --> | |
| <label for="target_language" id="target">Choose your target language:</label> | |
| <select id="language" name="target_language"> | |
| <option value="en">English</option> | |
| <option value="zh" selected>Chinese</option> | |
| <option value="ms">Malay</option> | |
| <option value="ta">Tamil</option> | |
| <option value="th">Thai</option> | |
| </select> | |
| <!-- div container for input & translation textareas --> | |
| <div class="kkk"> | |
| <textarea id="type" name="input" placeholder="Enter your user story here!">{{ input_text }}</textarea> | |
| <textarea id="out" name="out" placeholder="Your translated user story will appear here!" readonly>{{ translatedStory }}</textarea> | |
| </div> | |
| <!-- | |
| Jinja template for displaying flash messages. Gets all flash messages to be displayed on page. | |
| To note: Pay attention to the category name. It MUST match the category name given on flask-end (Refineverse.py)! | |
| --> | |
| {% with messages = get_flashed_messages(with_categories=true) %} | |
| {% for category, message in messages %} | |
| {% if category == 'error' %} | |
| <div class="alert alert-danger alert-dismissible fade show" role="alert"> | |
| {{ message }} | |
| <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button> | |
| </div> | |
| {% else %} | |
| <div class="alert alert-success alert-dismissible fade show" role="alert"> | |
| {{ message }} | |
| <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button> | |
| </div> | |
| {% endif %} | |
| {% endfor %} | |
| {% endwith %} | |
| <div class="kkkk"> | |
| <button id="clear" onclick="clearContent()" type="button">Clear</button> | |
| <button id="example" type="button" data-bs-toggle="tooltip" data-bs-placement="bottom" title="As a _ , I want to _ so that _ / 作为__ , 我想要__以便__。 / Sebagai__, saya mahu__supaya__. / என__, எனக்கு வேண்டும்__அதனால்__. / ในฐานะ__, ฉันต้องการ__เพื่อที่ฉัน__.">Example Formats</button> | |
| <button id="viewData" type="button" class="btn btn-primary" onclick="openPopup()">View History</button> | |
| <button id="translate" type="submit">Translate</button> | |
| </div> | |
| </form> | |
| <div class="back"> | |
| <a href="{{ url_for('index') }}"><button class="backb">Back</button></a> | |
| </div> | |
| <!-- Bootstrap JS Bundle --> | |
| <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ENjdO4Dr2bkBIFxQpeoTz1HIcje39Wm4jDKdf19U8gI4ddQ3GYNS7NTKfAdVQSZe" crossorigin="anonymous"></script> | |
| <script> | |
| const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]') | |
| const tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl)) | |
| // Function for cleaning content in textboxes | |
| function clearContent() | |
| { | |
| const type = document.getElementById('type'); | |
| const out = document.getElementById('out'); | |
| type.value = ''; | |
| out.value = ''; | |
| } | |
| // Function to open a popup window using Flask routing | |
| function openPopup() { | |
| // The second argument is used to give the window a name | |
| window.open('/translation_table', 'translation_table', 'width=600,height=400'); | |
| } | |
| </script> | |
| </body> | |
| </html> |