hungchiayu1
commited on
Commit
•
31fe691
1
Parent(s):
28e9fe3
add cache examples
Browse files
app.py
CHANGED
@@ -68,11 +68,11 @@ class Tango:
|
|
68 |
return list(self.chunks(outputs, samples))
|
69 |
|
70 |
# Initialize TANGO
|
|
|
|
|
|
|
|
|
71 |
|
72 |
-
tango = Tango(device="cpu")
|
73 |
-
tango.vae.to("cuda")
|
74 |
-
tango.stft.to("cuda")
|
75 |
-
tango.model.to("cuda")
|
76 |
|
77 |
@spaces.GPU(duration=60)
|
78 |
def gradio_generate(prompt, steps, guidance):
|
@@ -136,7 +136,7 @@ gr_interface = gr.Interface(
|
|
136 |
["A helicopter is in flight"],
|
137 |
["A dog barking and a man talking and a racing car passes by"],
|
138 |
],
|
139 |
-
cache_examples=
|
140 |
)
|
141 |
|
142 |
# Launch Gradio app
|
|
|
68 |
return list(self.chunks(outputs, samples))
|
69 |
|
70 |
# Initialize TANGO
|
71 |
+
if torch.cuda.is_available():
|
72 |
+
tango = Tango()
|
73 |
+
else:
|
74 |
+
tango = Tango(device="cpu")
|
75 |
|
|
|
|
|
|
|
|
|
76 |
|
77 |
@spaces.GPU(duration=60)
|
78 |
def gradio_generate(prompt, steps, guidance):
|
|
|
136 |
["A helicopter is in flight"],
|
137 |
["A dog barking and a man talking and a racing car passes by"],
|
138 |
],
|
139 |
+
cache_examples=True, # Turn on to cache.
|
140 |
)
|
141 |
|
142 |
# Launch Gradio app
|