This repository has been archived by the owner on Jun 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
52 lines (51 loc) · 2.14 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Text to Speech and Image Generation</title>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<style>
#images img {
max-width: 300px; /* Keep images hidden initially */
}
</style>
</head>
<body>
<h1>Text to Multimedia Conversion</h1>
<form id="textForm">
<label>Title:</label><input type="text" id="title"></input><br/><br/>
<textarea id="text_input" name="text_input" rows="7" cols="50" required></textarea>
<button type="button" onclick="submitText()">Convert</button>
</form>
<textarea id="text_show" rows="20" cols="70" style="display:none;" readonly></textarea>
<br>
<div id="images">
</div>
<audio controls id="audioPlayer" style="display:none;"></audio>
<video width="320" height="240" controls style="display:none;" id="videoPlayer"></video>
<a href="./output/video/output.mp4" id="download_button" style="display:none;" download="output.mp4">
Download Video
</a>
<script>
function submitText() {
alert("Please wait...");
var title=$('#title').val();
var text = $('#text_input').val().replace(/\n/g, " "); // Good practice to clean and prepare data here.
$.get('process.php', { inputText: text ,inputTitle: title}, function(data) {
alert("success");
$('#text_show').val(data.finaltext).show(); // Display the returned text status if needed.
$('#audioPlayer').attr('src', "./output/audio/"+data.audioname).show();
$('#videoPlayer').attr('src', data.videoname).show();
$('#download_button').attr('href',"./output/video/"+data.videoname).show();
displayImages(data.count,data.image_name,title);
}, 'json');
}
function displayImages(count,image_name,title) {
for(var i=0;i<count;i++){
var addimg="<img src='./output/image/"+title+"/"+image_name[i]+"'>";
$("#images").append(addimg);
}
}
</script>
</body>
</html>