fffiloni commited on
Commit
87edc0b
·
verified ·
1 Parent(s): e8bcac0

updates audioldm api

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -19,7 +19,7 @@ def check_api(model_name):
19
  return "api not ready yet"
20
  elif model_name == "AudioLDM-2":
21
  try :
22
- client = Client("https://haoheliu-audioldm2-text2audio-text2music.hf.space/")
23
  return "api ready"
24
  except :
25
  return "api not ready yet"
@@ -125,16 +125,16 @@ def get_magnet(prompt):
125
  return result[1]
126
 
127
  def get_audioldm(prompt):
128
- client = Client("https://haoheliu-audioldm2-text2audio-text2music.hf.space/")
129
  seed = random.randint(0, MAX_SEED)
130
  result = client.predict(
131
- prompt, # str in 'Input text' Textbox component
132
- "Low quality.", # str in 'Negative prompt' Textbox component
133
- 10, # int | float (numeric value between 5 and 15) in 'Duration (seconds)' Slider component
134
- 6.5, # int | float (numeric value between 0 and 7) in 'Guidance scale' Slider component
135
- seed, # int | float in 'Seed' Number component
136
- 3, # int | float (numeric value between 1 and 5) in 'Number waveforms to generate' Slider component
137
- fn_index=1
138
  )
139
  print(result)
140
  audio_result = extract_audio(result)
 
19
  return "api not ready yet"
20
  elif model_name == "AudioLDM-2":
21
  try :
22
+ client = Client("fffiloni/audioldm2-text2audio-text2music-API", hf_token=hf_token)
23
  return "api ready"
24
  except :
25
  return "api not ready yet"
 
125
  return result[1]
126
 
127
  def get_audioldm(prompt):
128
+ client = Client("fffiloni/audioldm2-text2audio-text2music-API", hf_token=hf_token)
129
  seed = random.randint(0, MAX_SEED)
130
  result = client.predict(
131
+ text=prompt, # str in 'Input text' Textbox component
132
+ negative_prompt="Low quality.", # str in 'Negative prompt' Textbox component
133
+ duration=10, # int | float (numeric value between 5 and 15) in 'Duration (seconds)' Slider component
134
+ guidance_scale=6.5, # int | float (numeric value between 0 and 7) in 'Guidance scale' Slider component
135
+ random_seed=seed, # int | float in 'Seed' Number component
136
+ n_candidates=3, # int | float (numeric value between 1 and 5) in 'Number waveforms to generate' Slider component
137
+ api_name="/text2audio"
138
  )
139
  print(result)
140
  audio_result = extract_audio(result)