Spaces:
Paused
Paused
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Generate and Download Design</title> | |
| <script> | |
| function generateDesign() { | |
| // Disabilita il pulsante per evitare richieste multiple | |
| const button = document.getElementById("generate-button"); | |
| button.disabled = true; | |
| button.innerText = "Processing..."; | |
| // Esegui la chiamata fetch per attivare il comando | |
| fetch('/generate-design', { method: 'POST' }) | |
| .then(() => { | |
| // Abilita il pulsante di download | |
| document.getElementById("download-button").style.display = "block"; | |
| button.disabled = false; | |
| button.innerText = "Run Command"; | |
| }) | |
| .catch(error => { | |
| console.error("Error:", error); | |
| button.disabled = false; | |
| button.innerText = "Run Command"; | |
| alert("Failed to execute the command."); | |
| }); | |
| } | |
| function getCurrentEndpoint() { | |
| fetch('/current-endpoint', { method: 'GET' }) | |
| .then(response => response.text()) | |
| .then(data => { | |
| // Display the current endpoint URL on the page | |
| document.getElementById("current-endpoint").innerText = data; | |
| console.log(data); // Log the current endpoint URL to the console | |
| }) | |
| .catch(error => { | |
| console.error("Error:", error); | |
| }); | |
| } | |
| </script> | |
| </head> | |
| <body> | |
| <h1>Generate Design</h1> | |
| <!-- Bottone per attivare la generazione --> | |
| <button id="generate-button" onclick="generateDesign()">Run Command</button> | |
| <br><br> | |
| <!-- Bottone per il download (nascosto fino a che non è pronto) --> | |
| <a id="download-button" href="/api/output/generato_paired_paired/images/03191_00.jpg" download style="display:none;"> | |
| Download Image | |
| </a> | |
| <br><br> | |
| <!-- New Button to Get Current Endpoint --> | |
| <button id="current-endpoint-button" onclick="getCurrentEndpoint()">Get Current URL</button> | |
| <p id="current-endpoint"></p> <!-- Displays the current endpoint --> | |
| </body> | |
| </html> | |