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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -10
app.py CHANGED
@@ -6,24 +6,27 @@ from gradio_client import Client
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):
28
  # Tango API를 사용하여 음성 생성
29
  client = Client("https://declare-lab-tango.hf.space/")
 
6
  image_model = pipeline("image-classification", model="google/vit-base-patch16-224")
7
 
8
  def generate_music(prompt):
9
+ # Initialize the client with your API endpoint
10
  client = Client("https://haoheliu-audioldm-48k-text-to-hifiaudio-generation.hf.space/")
11
 
12
+ # Call the predict method with the correct parameters
 
13
  result = client.predict(
14
+ prompt, # The main text input for your music generation
15
+ 5, # Duration in seconds
16
+ 0, # Guidance scale
17
+ 5, # Seed for generating music
18
+ 1, # Number of waveforms to generate
19
+ api_name="/text2audio" # Specify the API name if required
 
20
  )
21
 
22
+ # Assuming the result includes the information you need directly
23
  print(result)
24
  return result
25
 
26
+ # Example usage
27
+ prompt = "A serene and peaceful melody to relax."
28
+ music_result = generate_music(prompt)
29
+
30
  def generate_voice(prompt):
31
  # Tango API를 사용하여 음성 생성
32
  client = Client("https://declare-lab-tango.hf.space/")