Jofthomas HF staff commited on
Commit
1f2e686
1 Parent(s): 930024a

Update TextGen/suno.py

Browse files
Files changed (1) hide show
  1. TextGen/suno.py +5 -19
TextGen/suno.py CHANGED
@@ -27,6 +27,11 @@ def get_audio_information(audio_ids):
27
  return response.json()
28
 
29
 
 
 
 
 
 
30
  def get_quota_information():
31
  url = f"{base_url}/api/get_limit"
32
  response = requests.get(url)
@@ -50,22 +55,3 @@ def generate_lyrics(prompt):
50
  response = requests.post(url, json=payload)
51
  print(response)
52
  return response.json()
53
-
54
- if __name__ == '__main__':
55
- data = generate_audio_by_prompt({
56
- "prompt": "A popular heavy metal song about war, sung by a deep-voiced male singer, slowly and melodiously. The lyrics depict the sorrow of people after the war.",
57
- "make_instrumental": False,
58
- "wait_audio": False
59
- })
60
-
61
- ids = f"{data[0]['id']},{data[1]['id']}"
62
- print(f"ids: {ids}")
63
-
64
- for _ in range(60):
65
- data = get_audio_information(ids)
66
- if data[0]["status"] == 'streaming':
67
- print(f"{data[0]['id']} ==> {data[0]['audio_url']}")
68
- print(f"{data[1]['id']} ==> {data[1]['audio_url']}")
69
- break
70
- # sleep 5s
71
- time.sleep(5)
 
27
  return response.json()
28
 
29
 
30
+ def generate_lyrics(payload):
31
+ url = f"{base_url}/api/generate_lyrics"
32
+ response = requests.post(url, json=payload, headers={'Content-Type': 'application/json'})
33
+ return response.json()
34
+
35
  def get_quota_information():
36
  url = f"{base_url}/api/get_limit"
37
  response = requests.get(url)
 
55
  response = requests.post(url, json=payload)
56
  print(response)
57
  return response.json()