stardate69 commited on
Commit
c5d879f
·
verified ·
1 Parent(s): 2d5ac46

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -19,8 +19,8 @@ device = "cuda" if torch.cuda.is_available() else "cpu"
19
  torch_dtype = torch.float16 if device == "cuda" else torch.float32
20
 
21
  # Load the StableAudio model from Hugging Face Hub
22
- pipe = StableAudioPipeline.from_pretrained("stabilityai/stable-audio-open-1.0", torch_dtype=torch_dtype)
23
- pipe = pipe.to(device)
24
 
25
  # Initialize Flask app
26
  app = Flask(__name__)
@@ -38,6 +38,10 @@ def generate_audio():
38
 
39
  try:
40
 
 
 
 
 
41
  # Generate the audio using StableAudioPipeline
42
  generator = torch.Generator(device)
43
  generator.manual_seed(seed)
@@ -46,7 +50,7 @@ def generate_audio():
46
  prompt=prompt,
47
  negative_prompt='Low Quality',
48
  num_inference_steps=10, # Number of diffusion steps
49
- guidance_scale=10.0,
50
  audio_end_in_s=1,
51
  num_waveforms_per_prompt=1,
52
  generator=generator
 
19
  torch_dtype = torch.float16 if device == "cuda" else torch.float32
20
 
21
  # Load the StableAudio model from Hugging Face Hub
22
+ #pipe = StableAudioPipeline.from_pretrained("stabilityai/stable-audio-open-1.0", torch_dtype=torch_dtype)
23
+ #pipe = pipe.to(device)
24
 
25
  # Initialize Flask app
26
  app = Flask(__name__)
 
38
 
39
  try:
40
 
41
+ # Load the StableAudio model from Hugging Face Hub
42
+ pipe = StableAudioPipeline.from_pretrained("stabilityai/stable-audio-open-1.0", torch_dtype=torch_dtype)
43
+ pipe = pipe.to(device)
44
+
45
  # Generate the audio using StableAudioPipeline
46
  generator = torch.Generator(device)
47
  generator.manual_seed(seed)
 
50
  prompt=prompt,
51
  negative_prompt='Low Quality',
52
  num_inference_steps=10, # Number of diffusion steps
53
+ guidance_scale=14.0,
54
  audio_end_in_s=1,
55
  num_waveforms_per_prompt=1,
56
  generator=generator