fffiloni commited on
Commit
450bd2c
1 Parent(s): 74359c5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -3
app.py CHANGED
@@ -4,7 +4,19 @@ lpmc_client = gr.load("seungheondoh/LP-Music-Caps-demo", src="spaces")
4
  from gradio_client import Client
5
 
6
  client = Client("https://ysharma-explore-llamav2-with-tgi.hf.space/")
7
- sd = gr.load("runwayml/stable-diffusion-v1-5", src="spaces")
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
  from pydub import AudioSegment
10
 
@@ -63,9 +75,9 @@ def infer(audio_file):
63
 
64
  print(result)
65
 
66
- image = sd(result, fn_index=0)[0]
67
 
68
- return cap_result, result, image
69
 
70
  with gr.Blocks() as demo:
71
  with gr.Column(elem_id="col-container"):
 
4
  from gradio_client import Client
5
 
6
  client = Client("https://ysharma-explore-llamav2-with-tgi.hf.space/")
7
+
8
+ from diffusers import DiffusionPipeline
9
+ import torch
10
+
11
+ pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16, use_safetensors=True, variant="fp16")
12
+ pipe.to("cuda")
13
+
14
+ # if using torch < 2.0
15
+ # pipe.enable_xformers_memory_efficient_attention()
16
+
17
+
18
+
19
+
20
 
21
  from pydub import AudioSegment
22
 
 
75
 
76
  print(result)
77
 
78
+ images = pipe(prompt=result).images[0]
79
 
80
+ return cap_result, result, images
81
 
82
  with gr.Blocks() as demo:
83
  with gr.Column(elem_id="col-container"):