Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d8e964a

Browse filesBrowse files
authored
Update ChatGPT-Termux.py
1 parent 45a86ec commit d8e964a
Copy full SHA for d8e964a

File tree

1 file changed

+7
-7
lines changed
Filter options

1 file changed

+7
-7
lines changed

‎ChatGPT-Termux.py

Copy file name to clipboard
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
# ChatGPT-Python para Termux
1+
# ChatGPT-Python for Termux
22
import openai
33
from gtts import gTTS
44
import os
55

66
# OPENAI API KEY
77
openai.api_key = ""
8-
# Lista con despedidas comunes para finalizar el ciclo while
8+
# List with common departures to end the while loop
99
despedida = ["Adios", "adios", "bye", "Bye", "Hasta luego", "hasta luego"]
1010

1111
while True:
12-
# Entrada del usuario y verificacion si la entrada coincide con la lista de despedidas
12+
# User input and check if the input matches the list of goodbyes
1313
usuario = str(input("tu: "))
1414
if usuario in despedida:
1515
break
1616
else:
1717
prompt = (f"{usuario}")
1818

19-
# Obteniendo respuestas usando la API de OpenAI
19+
# Getting responses using the OpenAI API
2020
response = openai.Completion.create(
2121
engine="text-davinci-003",
2222
prompt=prompt,
@@ -25,13 +25,13 @@
2525

2626
respuesta = response["choices"][0]["text"]
2727
#print("ChatGPT:", response["choices"][0]["text"])
28-
# Convirtiendo texto a audio
28+
# Converting text to audio
2929
texto = str(respuesta)
3030
tts = gTTS(texto, lang="es")
3131
tts.save("audio.mp3")
32-
# Mostrando la respuesta en pantalla
32+
# Displaying the answer on the screen
3333
print("ChatGPT: ", respuesta)
34-
# Reproduciendo el audio
34+
# Playing the audio
3535
os.system("pulseaudio -D")
3636
os.system("play audio.mp3")
3737
os.system("pulseaudio -k")

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.