-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
50 lines (44 loc) · 1.38 KB
/
main.py
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
import argparse
from wikipod import utils
def main(voice_id, pages, model):
for page in pages:
dict = utils.scrape_page_content(page)
folder_name = utils.generate_output_file_name(dict)
print("Reading '", dict["title"], "'...")
content = utils.oai_clean_content(dict, model=model)
# Write content to file
print("Writing content to file...")
utils.write_content_to_file(
utils.format_for_web(content), "public/" + folder_name + "/index.html"
)
print("Generating audio...")
utils.generate_audio(
content, "public/" + folder_name + "/audio.mp3", voice_id=voice_id
)
print("Done!")
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Process some inputs.")
parser.add_argument(
"-v",
"--voice_id",
required=False,
help="ID of the voice to use",
default="UdScy37AbDCrWZuRANDL",
)
parser.add_argument(
"-m", "--model", required=False, help="GPT model to use", default="gpt-4"
)
parser.add_argument(
"-p",
"--pages",
nargs="+",
required=True,
help="List of Wikipedia pages",
default=["https://en.wikipedia.org/wiki/Special:Random"],
)
args = parser.parse_args()
main(
args.voice_id,
args.pages,
args.model,
)