Spaces:
Running
on
Zero
Running
on
Zero
czd358121692
commited on
Commit
•
e58a127
1
Parent(s):
66e0786
add randomizer to sample images
Browse files
app.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import os
|
2 |
import shutil
|
3 |
import gradio as gr
|
@@ -8,7 +9,6 @@ import torchaudio
|
|
8 |
from einops import rearrange
|
9 |
import psutil
|
10 |
import humanize
|
11 |
-
import spaces
|
12 |
from transformers import (
|
13 |
AutoProcessor,
|
14 |
AutoModelForVision2Seq,
|
@@ -17,6 +17,7 @@ from transformers import (
|
|
17 |
from huggingface_hub import scan_cache_dir
|
18 |
from stable_audio_tools import get_pretrained_model
|
19 |
from stable_audio_tools.inference.generation import generate_diffusion_cond
|
|
|
20 |
|
21 |
CACHE_ROOT = '/tmp'
|
22 |
os.environ['HF_HOME'] = CACHE_ROOT
|
@@ -288,7 +289,8 @@ def get_image_examples():
|
|
288 |
for filename in os.listdir(image_dir):
|
289 |
if any(filename.lower().endswith(ext) for ext in image_extensions):
|
290 |
examples.append([os.path.join(image_dir, filename)])
|
291 |
-
|
|
|
292 |
return examples
|
293 |
|
294 |
@spaces.GPU(enable_queue=True)
|
|
|
1 |
+
import spaces
|
2 |
import os
|
3 |
import shutil
|
4 |
import gradio as gr
|
|
|
9 |
from einops import rearrange
|
10 |
import psutil
|
11 |
import humanize
|
|
|
12 |
from transformers import (
|
13 |
AutoProcessor,
|
14 |
AutoModelForVision2Seq,
|
|
|
17 |
from huggingface_hub import scan_cache_dir
|
18 |
from stable_audio_tools import get_pretrained_model
|
19 |
from stable_audio_tools.inference.generation import generate_diffusion_cond
|
20 |
+
import random
|
21 |
|
22 |
CACHE_ROOT = '/tmp'
|
23 |
os.environ['HF_HOME'] = CACHE_ROOT
|
|
|
289 |
for filename in os.listdir(image_dir):
|
290 |
if any(filename.lower().endswith(ext) for ext in image_extensions):
|
291 |
examples.append([os.path.join(image_dir, filename)])
|
292 |
+
|
293 |
+
random.shuffle(examples)
|
294 |
return examples
|
295 |
|
296 |
@spaces.GPU(enable_queue=True)
|