Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,13 +1,10 @@
|
|
1 |
import streamlit as st
|
2 |
from PIL import Image
|
3 |
import os
|
4 |
-
from
|
5 |
|
6 |
st.image('calamo.png', caption="", use_column_width=False)
|
7 |
|
8 |
-
# Initialize OpenAI and Whisper
|
9 |
-
openai = OpenAI(api_key=os.environ.get("OPENAI_API_KEY"))
|
10 |
-
whisper = Whisper(openai)
|
11 |
|
12 |
client = Groq(
|
13 |
api_key=os.environ.get("GROQ_API_KEY"),
|
@@ -42,10 +39,9 @@ def process_text(input_text):
|
|
42 |
|
43 |
def generate_audio(input_text):
|
44 |
tts = process_text(input_text)
|
45 |
-
speech =
|
46 |
-
|
47 |
-
|
48 |
-
return "whisper_out.wav"
|
49 |
|
50 |
user_input = st.text_input("Pega un texto para aclararlo y escuchar una lectura.")
|
51 |
|
@@ -54,4 +50,4 @@ if st.button('Aclarar'):
|
|
54 |
st.write("Pega un texto aquí")
|
55 |
else:
|
56 |
speech_file = generate_audio(user_input)
|
57 |
-
st.audio(speech_file, format='audio/
|
|
|
1 |
import streamlit as st
|
2 |
from PIL import Image
|
3 |
import os
|
4 |
+
from gtts import gTTS
|
5 |
|
6 |
st.image('calamo.png', caption="", use_column_width=False)
|
7 |
|
|
|
|
|
|
|
8 |
|
9 |
client = Groq(
|
10 |
api_key=os.environ.get("GROQ_API_KEY"),
|
|
|
39 |
|
40 |
def generate_audio(input_text):
|
41 |
tts = process_text(input_text)
|
42 |
+
speech = gTTS(text=tts, lang='es', slow=False)
|
43 |
+
speech.save("gtts_out.mp3")
|
44 |
+
return "gtts_out.mp3"
|
|
|
45 |
|
46 |
user_input = st.text_input("Pega un texto para aclararlo y escuchar una lectura.")
|
47 |
|
|
|
50 |
st.write("Pega un texto aquí")
|
51 |
else:
|
52 |
speech_file = generate_audio(user_input)
|
53 |
+
st.audio(speech_file, format='audio/mp3')
|