Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
-
#
|
12 |
-
# Adjust the names and values according to the API's actual requirements
|
13 |
result = client.predict(
|
14 |
-
prompt
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
#
|
20 |
-
# api_name="/text2audio" # Comment this out if api_name is not an expected argument
|
21 |
)
|
22 |
|
23 |
-
#
|
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/")
|