Spaces:
Running
Running
File size: 579 Bytes
51c43d6 2f0eefe 51c43d6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# app.py
from flask import Flask, render_template, send_from_directory
import os
app = Flask(__name__)
# Add route for serving audio files
@app.route('/audio/<path:filename>')
def serve_audio(filename):
return send_from_directory('static/audio', filename)
@app.route("/")
def home():
# Get list of audio files
audio_dir = os.path.join('static', 'audio')
audio_files = sorted([f for f in os.listdir(audio_dir) if f.endswith(('.mp3', '.wav'))])
return render_template("index.html", audio_files=audio_files)
if __name__ == "__main__":
app.run(debug=True) |