-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmenu.py
More file actions
88 lines (59 loc) · 2.32 KB
/
menu.py
File metadata and controls
88 lines (59 loc) · 2.32 KB
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
from colors import COLORS
from os import system
import transcribe
# ----------------------------------------------------------------
def menu_header():
print(
COLORS.CYAN
+ "╔═════════════════════════════╗\n"
+ "║ pyTranscript v1.0.0 ║\n"
+ "╚═════════════════════════════╝\n"
+ COLORS.RESET
)
def main_menu():
print(COLORS.CYAN + COLORS.UNDERLINE + "Seleccione una opción:" + COLORS.RESET)
print("1. Transcribir desde micrófono")
print("2. Transcribir desde archivo de audio")
print("3. Salir\n")
def menu():
while True:
system("cls")
menu_header()
main_menu()
option = input("Ingrese el número de la opción deseada: ")
if option == "1":
transcribe_from_microphone_option()
elif option == "2":
transcribe_from_file_option()
elif option == "3":
transcribe._
exit()
# ----------------------------------------------------------------
def transcribe_from_microphone_option():
system("cls")
print(COLORS.YELLOW + "Por favor, habla ahora..." + COLORS.RESET, "\n")
text = transcribe.from_microphone()
if text is not None:
transcribe.save_text(text)
print(COLORS.GREEN + "Transcripción exitosa:" + COLORS.RESET, "\n")
print(text, "\n")
print(COLORS.GREEN + "Archivo guardado como: 'output.txt'" + COLORS.RESET)
input("Presione una tecla para volver al menú principal.")
# ----------------------------------------------------------------
def transcribe_from_file_option():
system("cls")
audio_file = input(
"Ingrese el nombre del archivo de audio "
+ COLORS.YELLOW
+ "(.wav)"
+ COLORS.RESET
+ ": "
)
print(COLORS.YELLOW + "Procesando, espere..." + COLORS.RESET, "\n")
text = transcribe.from_file(audio_file)
if text is not None:
transcribe.save_text(text)
print(COLORS.GREEN + "Transcripción exitosa:" + COLORS.RESET, "\n")
print(text, "\n")
print(COLORS.GREEN + "Archivo guardado como: 'output.txt'" + COLORS.RESET)
input("Presione una tecla para volver al menú principal.")