Spaces:
Running
Running
<html> | |
<head> | |
<title>Dialogue Summarizer</title> | |
<style> | |
body { | |
font-family: Arial, sans-serif; | |
margin: 40px; | |
background-color: #f4f4f4; | |
} | |
form { | |
background-color: #fff; | |
padding: 20px; | |
border-radius: 5px; | |
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); | |
} | |
label { | |
display: block; | |
margin-bottom: 10px; | |
} | |
textarea { | |
width: 100%; | |
min-height: 150px; | |
padding: 10px; | |
margin-bottom: 10px; | |
border: 1px solid #ccc; | |
border-radius: 4px; | |
resize: vertical; | |
} | |
button { | |
padding: 10px 15px; | |
background-color: #007bff; | |
color: #fff; | |
border: none; | |
border-radius: 4px; | |
cursor: pointer; | |
} | |
button:hover { | |
background-color: #0056b3; | |
} | |
#result { | |
margin-top: 30px; | |
padding: 20px; | |
background-color: #fff; | |
border-radius: 5px; | |
} | |
h2 { | |
margin-top: 0; | |
} | |
</style> | |
</head> | |
<body> | |
<h1>Dialogue Summarizer</h1> | |
<p>This model provides abstractive summaries for dialogues. Enter your dialogue below and get a concise summary.</p> | |
<form id="textForm"> | |
<label for="textAreaInput">Enter your dialogue:</label> | |
<textarea id="textAreaInput" name="text" required maxlength="1000"></textarea> | |
<button type="submit">Submit</button> | |
</form> | |
<div id="result"> | |
<h2>Summary:</h2> | |
</div> | |
<script> | |
document.getElementById('textForm').addEventListener('submit', function (event) { | |
event.preventDefault(); | |
let formData = new FormData(event.target); | |
let jsonData = {}; | |
formData.forEach((value, key) => jsonData[key] = value); | |
fetch('/create-summary', { | |
method: 'POST', | |
headers: { | |
'Content-Type': 'application/json', | |
}, | |
body: JSON.stringify(jsonData), | |
}) | |
.then(response => response.json()) | |
.then(data => { | |
display_result(data); | |
}) | |
.catch(error => { | |
console.error('Error:', error); | |
}); | |
}); | |
function display_result(data) { | |
let resultDiv = document.getElementById('result'); | |
let responseDiv = document.createElement('div'); | |
responseDiv.innerText = data.result.summary_text; | |
resultDiv.appendChild(responseDiv); | |
} | |
</script> | |
</body> | |
</html> | |