Upload static_index (37).html
Browse files- static_index (37).html +36 -0
static_index (37).html
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Image to Story Generator</title>
|
| 7 |
+
</head>
|
| 8 |
+
<body>
|
| 9 |
+
<h1>Image to Story Generator</h1>
|
| 10 |
+
<form id="upload-form" enctype="multipart/form-data">
|
| 11 |
+
<input type="file" name="file" id="file">
|
| 12 |
+
<button type="button" id="upload-btn">Upload Image</button>
|
| 13 |
+
</form>
|
| 14 |
+
<div id="result"></div>
|
| 15 |
+
|
| 16 |
+
<script>
|
| 17 |
+
document.getElementById("upload-btn").addEventListener("click", function() {
|
| 18 |
+
var formData = new FormData();
|
| 19 |
+
var fileInput = document.getElementById('file');
|
| 20 |
+
formData.append('image_file', fileInput.files[0]);
|
| 21 |
+
|
| 22 |
+
fetch('/generate-story/', {
|
| 23 |
+
method: 'POST',
|
| 24 |
+
body: formData
|
| 25 |
+
})
|
| 26 |
+
.then(response => response.json())
|
| 27 |
+
.then(data => {
|
| 28 |
+
document.getElementById('result').innerText = data.story;
|
| 29 |
+
})
|
| 30 |
+
.catch(error => {
|
| 31 |
+
console.error('Error:', error);
|
| 32 |
+
});
|
| 33 |
+
});
|
| 34 |
+
</script>
|
| 35 |
+
</body>
|
| 36 |
+
</html>
|