Spaces:
Runtime error
Runtime error
File size: 648 Bytes
38e694c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
import os
import fire
from anything2image.api import Anything2Image
import soundfile as sf
from PIL import Image
import numpy as np
def main(
prompt='', audio=None, image=None, text=None,
ckpt_dir=os.path.join(os.path.expanduser('~'), 'anything2image', 'checkpoints')
):
anything2img = Anything2Image(imagebind_download_dir=ckpt_dir)
if audio is not None:
data, samplerate = sf.read(audio)
audio = (samplerate, data)
if image is not None:
image = np.array(Image.open(image))
image = anything2img(prompt=prompt, audio=audio, image=image, text=text)
image.save('cli_output.png')
fire.Fire(main) |