forked from FujiwaraChoki/MoneyPrinter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
284 lines (265 loc) · 10.5 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>MoneyPrinter</title>
<link
rel="icon"
href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>💸</text></svg>"
/>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/tailwindcss/2.0.2/tailwind.min.css"
/>
</head>
<body class="bg-blue-100 min-h-screen justify-center p-40">
<h1 class="text-4xl text-center mb-4">MoneyPrinter</h1>
<p class="text-center text-gray-700">
This Application is intended to automate the creation and uploads of
YouTube Shorts.
</p>
<div class="flex justify-center mt-8">
<div class="max-w-xl flex flex-col space-y-4 w-full">
<label for="aiModel" class="text-blue-600">AI Model</label>
<select
name="aiModel"
id="aiModel"
class="w-full border-2 border-blue-300 p-2 rounded-md focus:outline-none focus:border-blue-500"
>
<option value="g4f">g4f (Free)</option>
<option value="gpt3.5-turbo">OpenAI GPT-3.5</option>
<option value="gpt4">OpenAI GPT-4</option>
</select>
<label for="voice" class="text-blue-600">Voice</label>
<select
name="voice"
id="voice"
class="w-min border-2 border-blue-300 p-2 rounded-md focus:outline-none focus:border-blue-500"
>
<option value="en_us_ghostface">Ghost Face</option>
<option value="en_us_chewbacca">Chewbacca</option>
<option value="en_us_c3po">C3PO</option>
<option value="en_us_stitch">Stitch</option>
<option value="en_us_stormtrooper">Stormtrooper</option>
<option value="en_us_rocket">Rocket</option>
<option value="en_au_001">English AU - Female</option>
<option value="en_au_002">English AU - Male</option>
<option value="en_uk_001">English UK - Male 1</option>
<option value="en_uk_003">English UK - Male 2</option>
<option value="en_us_001">English US - Female (Int. 1)</option>
<option value="en_us_002">English US - Female (Int. 2)</option>
<option value="en_us_006">English US - Male 1</option>
<option value="en_us_007">English US - Male 2</option>
<option value="en_us_009">English US - Male 3</option>
<option value="en_us_010">English US - Male 4</option>
<option value="fr_001">French - Male 1</option>
<option value="fr_002">French - Male 2</option>
<option value="de_001">German - Female</option>
<option value="de_002">German - Male</option>
<option value="es_002">Spanish - Male</option>
<option value="es_mx_002">Spanish MX - Male</option>
<option value="br_001">Portuguese BR - Female 1</option>
<option value="br_003">Portuguese BR - Female 2</option>
<option value="br_004">Portuguese BR - Female 3</option>
<option value="br_005">Portuguese BR - Male</option>
<option value="id_001">Indonesian - Female</option>
<option value="jp_001">Japanese - Female 1</option>
<option value="jp_003">Japanese - Female 2</option>
<option value="jp_005">Japanese - Female 3</option>
<option value="jp_006">Japanese - Male</option>
<option value="kr_002">Korean - Male 1</option>
<option value="kr_003">Korean - Female</option>
<option value="kr_004">Korean - Male 2</option>
<option value="en_female_f08_salut_damour">Alto</option>
<option value="en_male_m03_lobby">Tenor</option>
<option value="en_female_f08_warmy_breeze">Warmy Breeze</option>
<option value="en_male_m03_sunshine_soon">Sunshine Soon</option>
<option value="en_male_narration">narrator</option>
<option value="en_male_funny">wacky</option>
<option value="en_female_emotional">peaceful</option>
</select>
<label for="zipUrl" class="text-blue-600"
>Zip URL (Leave empty for default)</label
>
<input
type="text"
name="zipUrl"
id="zipUrl"
class="border-2 border-blue-300 p-2 rounded-md focus:outline-none focus:border-blue-500"
/>
<label for="videoSubject" class="text-blue-600">Subject</label>
<textarea
rows="3"
type="text"
name="videoSubject"
id="videoSubject"
class="border-2 border-blue-300 p-2 rounded-md focus:outline-none focus:border-blue-500"
></textarea>
<label for="paragraphNumber" class="text-blue-600"
>Paragraph Number</label
>
<input
type="number"
name="paragraphNumber"
id="paragraphNumber"
class="border-2 border-blue-300 p-2 rounded-md focus:outline-none focus:border-blue-500"
value="1"
min="1"
max="100"
/>
<label
for="youtubeUploadToggle"
class="flex items-center text-blue-600"
>
<input
type="checkbox"
name="youtubeUploadToggle"
id="youtubeUploadToggle"
class="mr-2"
/>
Automate YouTube Uploads
</label>
<label for="useMusicToggle" class="flex items-center text-blue-600">
<input
type="checkbox"
name="useMusicToggle"
id="useMusicToggle"
class="mr-2"
/>
Use Music
</label>
<button
id="generateButton"
class="bg-blue-500 hover:bg-blue-700 duration-100 linear text-white px-4 py-2 rounded-md"
>
Generate
</button>
<button
id="cancelButton"
class="bg-red-500 hover:bg-red-700 duration-100 linear text-white px-4 py-2 rounded-md hidden"
>
Cancel
</button>
</div>
</div>
<footer class="flex justify-center mt-8">
<div class="flex flex-col space-y-4">
<p class="text-center text-gray-700">
Made with ❤️ by
<a
class="text-blue-600"
target="href"
href="https://github.com/FujiwaraChoki"
>
Fuji Codes
</a>
</p>
</div>
</footer>
<script>
const videoSubject = document.querySelector("#videoSubject");
const aiModel = document.querySelector("#aiModel");
const voice = document.querySelector("#voice");
const zipUrl = document.querySelector("#zipUrl");
const paragraphNumber = document.querySelector("#paragraphNumber");
const youtubeToggle = document.querySelector("#youtubeUploadToggle");
const useMusicToggle = document.querySelector("#useMusicToggle");
const generateButton = document.querySelector("#generateButton");
const cancelButton = document.querySelector("#cancelButton");
const cancelGeneration = () => {
console.log("Canceling generation...");
// Send request to /cancel
fetch("http://localhost:8080/api/cancel", {
method: "POST",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
},
})
.then((response) => response.json())
.then((data) => {
alert(data.message);
console.log(data);
})
.catch((error) => {
alert("An error occurred. Please try again later.");
console.log(error);
});
// Hide cancel button
cancelButton.classList.add("hidden");
// Enable generate button
generateButton.disabled = false;
generateButton.classList.remove("hidden");
};
const generateVideo = () => {
console.log("Generating video...");
// Disable button and change text
generateButton.disabled = true;
generateButton.classList.add("hidden");
// Show cancel button
cancelButton.classList.remove("hidden");
// Get values from input fields
const videoSubjectValue = videoSubject.value;
const aiModelValue = aiModel.value;
const voiceValue = voice.value;
const paragraphNumberValue = paragraphNumber.value;
const youtubeUpload = youtubeToggle.checked;
const useMusicToggleState = useMusicToggle.checked;
const zipUrlValue = zipUrl.value;
const url = "http://localhost:8080/api/generate";
// Construct data to be sent to the server
const data = {
videoSubject: videoSubjectValue,
aiModel: aiModelValue,
voice: voiceValue,
paragraphNumber: paragraphNumberValue,
automateYoutubeUpload: youtubeUpload,
useMusic: useMusicToggleState,
zipUrl: zipUrlValue,
};
// Send the actual request to the server
fetch(url, {
method: "POST",
body: JSON.stringify(data),
headers: {
"Content-Type": "application/json",
Accept: "application/json",
},
})
.then((response) => response.json())
.then((data) => {
console.log(data);
alert(data.message);
// Hide cancel button after generation is complete
generateButton.disabled = false;
generateButton.classList.remove("hidden");
cancelButton.classList.add("hidden");
})
.catch((error) => {
alert("An error occurred. Please try again later.");
console.log(error);
});
};
generateButton.addEventListener("click", generateVideo);
cancelButton.addEventListener("click", cancelGeneration);
videoSubject.addEventListener("keyup", (event) => {
if (event.key === "Enter") {
generateVideo();
}
});
// Load the data from localStorage on page load
document.addEventListener("DOMContentLoaded", (event) => {
const voiceSelect = document.getElementById("voice");
const storedVoiceValue = localStorage.getItem("voiceValue");
if (storedVoiceValue) {
voiceSelect.value = storedVoiceValue;
}
});
// When the voice select field changes, store the new value in localStorage.
document.getElementById("voice").addEventListener("change", (event) => {
localStorage.setItem("voiceValue", event.target.value);
});
</script>
</body>
</html>