Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -179,6 +179,9 @@ def generate_audio_from_image(image):
|
|
179 |
# Convert to the required format (e.g., float32)
|
180 |
generated_audio = generated_audio.astype(np.float32)
|
181 |
|
|
|
|
|
|
|
182 |
return generated_audio, sample_rate
|
183 |
|
184 |
|
@@ -193,10 +196,10 @@ def main():
|
|
193 |
model_path = './gan_model.pth' # Ensure the model is in the correct relative path
|
194 |
generator = load_gan_model(generator, model_path, device)
|
195 |
|
196 |
-
# Gradio interface: allow users to upload an image and generate audio
|
197 |
iface = gr.Interface(fn=generate_audio_from_image,
|
198 |
-
|
199 |
-
|
|
|
200 |
|
201 |
|
202 |
iface.launch()
|
|
|
179 |
# Convert to the required format (e.g., float32)
|
180 |
generated_audio = generated_audio.astype(np.float32)
|
181 |
|
182 |
+
# Debug: Print the shape and type of the generated audio
|
183 |
+
print(f"Generated audio shape: {generated_audio.shape}, type: {generated_audio.dtype}")
|
184 |
+
|
185 |
return generated_audio, sample_rate
|
186 |
|
187 |
|
|
|
196 |
model_path = './gan_model.pth' # Ensure the model is in the correct relative path
|
197 |
generator = load_gan_model(generator, model_path, device)
|
198 |
|
|
|
199 |
iface = gr.Interface(fn=generate_audio_from_image,
|
200 |
+
inputs=gr.Image(type="pil"),
|
201 |
+
outputs=gr.Audio(type="numpy", label="Generated Audio"))
|
202 |
+
|
203 |
|
204 |
|
205 |
iface.launch()
|