Spaces:
Running
on
Zero
Running
on
Zero
Fabrice-TIERCELIN
commited on
Commit
•
08c4a40
1
Parent(s):
b611a12
Make the result different at each run
Browse files
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import torch
|
2 |
import torchaudio
|
|
|
3 |
from einops import rearrange
|
4 |
import gradio as gr
|
5 |
import spaces
|
@@ -27,6 +28,10 @@ def load_model():
|
|
27 |
# Function to set up, generate, and process the audio
|
28 |
@spaces.GPU(duration=120) # Allocate GPU only when this function is called
|
29 |
def generate_audio(prompt, sampler_type_dropdown, seconds_total=30, steps=100, cfg_scale=7,sigma_min_slider=0.3,sigma_max_slider=500, progress=gr.Progress(track_tqdm=True)):
|
|
|
|
|
|
|
|
|
30 |
print(f"Prompt received: {prompt}")
|
31 |
print(f"Settings: Duration={seconds_total}s, Steps={steps}, CFG Scale={cfg_scale}")
|
32 |
|
|
|
1 |
import torch
|
2 |
import torchaudio
|
3 |
+
import random
|
4 |
from einops import rearrange
|
5 |
import gradio as gr
|
6 |
import spaces
|
|
|
28 |
# Function to set up, generate, and process the audio
|
29 |
@spaces.GPU(duration=120) # Allocate GPU only when this function is called
|
30 |
def generate_audio(prompt, sampler_type_dropdown, seconds_total=30, steps=100, cfg_scale=7,sigma_min_slider=0.3,sigma_max_slider=500, progress=gr.Progress(track_tqdm=True)):
|
31 |
+
seed = random.randint(0, 2**63 - 1)
|
32 |
+
random.seed(seed)
|
33 |
+
torch.manual_seed(seed)
|
34 |
+
|
35 |
print(f"Prompt received: {prompt}")
|
36 |
print(f"Settings: Duration={seconds_total}s, Steps={steps}, CFG Scale={cfg_scale}")
|
37 |
|