Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,8 +2,12 @@ import gradio as gr
|
|
| 2 |
import spaces
|
| 3 |
import json
|
| 4 |
import re
|
|
|
|
|
|
|
| 5 |
from gradio_client import Client
|
| 6 |
|
|
|
|
|
|
|
| 7 |
def check_api(model_name):
|
| 8 |
if model_name == "MAGNet":
|
| 9 |
try :
|
|
@@ -129,12 +133,13 @@ def get_magnet(prompt):
|
|
| 129 |
|
| 130 |
def get_audioldm(prompt):
|
| 131 |
client = Client("https://haoheliu-audioldm2-text2audio-text2music.hf.space/")
|
|
|
|
| 132 |
result = client.predict(
|
| 133 |
prompt, # str in 'Input text' Textbox component
|
| 134 |
"Low quality.", # str in 'Negative prompt' Textbox component
|
| 135 |
10, # int | float (numeric value between 5 and 15) in 'Duration (seconds)' Slider component
|
| 136 |
6.5, # int | float (numeric value between 0 and 7) in 'Guidance scale' Slider component
|
| 137 |
-
|
| 138 |
3, # int | float (numeric value between 1 and 5) in 'Number waveforms to generate' Slider component
|
| 139 |
fn_index=1
|
| 140 |
)
|
|
|
|
| 2 |
import spaces
|
| 3 |
import json
|
| 4 |
import re
|
| 5 |
+
import random
|
| 6 |
+
import numpy as np
|
| 7 |
from gradio_client import Client
|
| 8 |
|
| 9 |
+
MAX_SEED = np.iinfo(np.int32).max
|
| 10 |
+
|
| 11 |
def check_api(model_name):
|
| 12 |
if model_name == "MAGNet":
|
| 13 |
try :
|
|
|
|
| 133 |
|
| 134 |
def get_audioldm(prompt):
|
| 135 |
client = Client("https://haoheliu-audioldm2-text2audio-text2music.hf.space/")
|
| 136 |
+
seed = random.randint(0, MAX_SEED)
|
| 137 |
result = client.predict(
|
| 138 |
prompt, # str in 'Input text' Textbox component
|
| 139 |
"Low quality.", # str in 'Negative prompt' Textbox component
|
| 140 |
10, # int | float (numeric value between 5 and 15) in 'Duration (seconds)' Slider component
|
| 141 |
6.5, # int | float (numeric value between 0 and 7) in 'Guidance scale' Slider component
|
| 142 |
+
seed, # int | float in 'Seed' Number component
|
| 143 |
3, # int | float (numeric value between 1 and 5) in 'Number waveforms to generate' Slider component
|
| 144 |
fn_index=1
|
| 145 |
)
|