seawolf2357 commited on
Commit
3bf7aef
·
verified ·
1 Parent(s): 3b24c11

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -9
app.py CHANGED
@@ -6,19 +6,22 @@ from gradio_client import Client
6
  image_model = pipeline("image-classification", model="google/vit-base-patch16-224")
7
 
8
  def generate_music(prompt):
9
- # audioldm API 사용하여 음악 생성 API 호출
10
  client = Client("https://haoheliu-audioldm-48k-text-to-hifiaudio-generation.hf.space/")
 
 
 
11
  result = client.predict(
12
- "playing piano.", # str in 'Input text' Textbox component
13
- "Low quality.", # str in 'Negative prompt' Textbox component
14
- 5, # int | float (numeric value between 5 and 15) in 'Duration (seconds)' Slider component
15
- 5.5, # int | float (numeric value between 0 and 7) in 'Guidance scale' Slider component
16
- 5, # int | float in 'Seed' Number component
17
- 3, # int | float (numeric value between 1 and 5) in 'Number waveforms to generate' Slider component
18
- api_name="/text2audio"
19
  )
 
 
20
  print(result)
21
- #audio_result = extract_audio(result)
22
  return result
23
 
24
  def generate_voice(prompt):
 
6
  image_model = pipeline("image-classification", model="google/vit-base-patch16-224")
7
 
8
  def generate_music(prompt):
 
9
  client = Client("https://haoheliu-audioldm-48k-text-to-hifiaudio-generation.hf.space/")
10
+
11
+ # Assuming the API requires these five arguments: prompt, duration, guidance_scale, seed, and num_waveforms
12
+ # Adjust the names and values according to the API's actual requirements
13
  result = client.predict(
14
+ prompt=prompt,
15
+ duration=5,
16
+ guidance_scale=5.5,
17
+ seed=5,
18
+ num_waveforms=3,
19
+ # Remove the api_name if it's not expected/needed, or adjust accordingly
20
+ # api_name="/text2audio" # Comment this out if api_name is not an expected argument
21
  )
22
+
23
+ # Process the result
24
  print(result)
 
25
  return result
26
 
27
  def generate_voice(prompt):