main
Brett Kuprel 2 years ago
parent a21ea6ea14
commit a79d30f718
  1. 6
      image_from_text.py
  2. 2
      replicate/predict.py

@ -27,9 +27,9 @@ def ascii_from_image(image: Image.Image, size: int) -> str:
def save_image(image: Image.Image, path: str):
if os.path.isdir(path):
path = os.path.join(path, 'generated.png')
elif not path.endswith('.png'):
path += '.png'
path = os.path.join(path, 'generated.jpg')
elif not path.endswith('.jpg'):
path += '.jpg'
print("saving image to", path)
image.save(path)
return image

@ -25,7 +25,7 @@ class Predictor(BasePredictor):
)
) -> Path:
image = self.model.generate_image(text, seed, grid_size=grid_size)
out_path = Path(tempfile.mkdtemp()) / 'output.png'
out_path = Path(tempfile.mkdtemp()) / 'output.jpg'
image.save(str(out_path))
return out_path
Loading…
Cancel
Save