zenjoul80 commited on
Commit
ff963d3
·
verified ·
1 Parent(s): 7a3503a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -7
app.py CHANGED
@@ -46,9 +46,9 @@ def callback():
46
 
47
  return jsonify({"status": "ok"}), 200
48
 
49
- @app.route('/get_music')
50
- def get_music():
51
- return send_from_directory(MUSIC_FOLDER, as_attachment=True)
52
 
53
  @socketio.on('save_token')
54
  def save_token(data):
@@ -66,8 +66,8 @@ def handle_gen(payload):
66
 
67
  # DOCKER FIX: Use the 'origin' header if available to set callback
68
  # If on HF, request.host_url works, but we provide a fallback
69
- callback_base = request.host_url.replace("https://zenjoul80-suno-api.hf.space/")
70
- payload['callBackUrl'] = "https://zenjoul80-suno-api.hf.space/callback"
71
 
72
  try:
73
  res = requests.post("https://api.sunoapi.org/api/v1/generate/upload-cover", json=payload, headers=headers)
@@ -83,5 +83,4 @@ def handle_gen(payload):
83
  emit('status', {'msg': f'❌ Connection Error: {str(e)}'})
84
 
85
  if __name__ == '__main__':
86
- socketio.run(app, host="0.0.0.0", port=7860)
87
-
 
46
 
47
  return jsonify({"status": "ok"}), 200
48
 
49
+ @app.route('/get_music/<filename>')
50
+ def get_music(filename):
51
+ return send_from_directory(MUSIC_FOLDER, filename, as_attachment=True)
52
 
53
  @socketio.on('save_token')
54
  def save_token(data):
 
66
 
67
  # DOCKER FIX: Use the 'origin' header if available to set callback
68
  # If on HF, request.host_url works, but we provide a fallback
69
+ callback_base = request.host_url.replace("0.0.0.0", "direct-url-here")
70
+ payload['callBackUrl'] = "https://zenjoul80-suno-api.hf.space/" + "callback"
71
 
72
  try:
73
  res = requests.post("https://api.sunoapi.org/api/v1/generate/upload-cover", json=payload, headers=headers)
 
83
  emit('status', {'msg': f'❌ Connection Error: {str(e)}'})
84
 
85
  if __name__ == '__main__':
86
+ socketio.run(app, host="0.0.0.0", port=7860)