Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -80,16 +80,19 @@ def generate_image(emotion_prediction, transcribed_text, image_folder='huggingfa
|
|
80 |
print("Error generating image:", e)
|
81 |
return None
|
82 |
|
|
|
83 |
# Function to get predictions
|
84 |
def get_predictions(audio_input, huggingface_folder='huggingface'):
|
85 |
-
|
86 |
-
|
|
|
87 |
texto_imagen = emotion_prediction + transcribed_text
|
88 |
image = generate_image(api_key, texto_imagen, image_folder=huggingface_folder)
|
89 |
# Save audio
|
90 |
-
os.rename(
|
91 |
return emotion_prediction, transcribed_text, image
|
92 |
|
|
|
93 |
# Create the Gradio interface
|
94 |
interface = gr.Interface(
|
95 |
fn=get_predictions,
|
|
|
80 |
print("Error generating image:", e)
|
81 |
return None
|
82 |
|
83 |
+
|
84 |
# Function to get predictions
|
85 |
def get_predictions(audio_input, huggingface_folder='huggingface'):
|
86 |
+
temp_audio_path = gradio.inputs.FilesMixin.get_file(audio_input, save_path='huggingface')
|
87 |
+
emotion_prediction = predict_emotion_from_audio(temp_audio_path)
|
88 |
+
transcribed_text = transcribe(temp_audio_path)
|
89 |
texto_imagen = emotion_prediction + transcribed_text
|
90 |
image = generate_image(api_key, texto_imagen, image_folder=huggingface_folder)
|
91 |
# Save audio
|
92 |
+
os.rename(temp_audio_path, os.path.join(huggingface_folder, 'input_audio.wav'))
|
93 |
return emotion_prediction, transcribed_text, image
|
94 |
|
95 |
+
|
96 |
# Create the Gradio interface
|
97 |
interface = gr.Interface(
|
98 |
fn=get_predictions,
|