Skip to content

Commit

Permalink
backwards compatibility flux app
Browse files Browse the repository at this point in the history
  • Loading branch information
javierluraschi committed Sep 5, 2024
1 parent 39c4832 commit a571c76
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions apps/flux/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,19 @@

from PIL import Image
from io import BytesIO
import hal9 as h9
import shutil

def flux_image(prompt, filename):
output = replicate.run("black-forest-labs/flux-dev", input={"prompt": prompt})
image_url = output[0]

response = requests.get(image_url)
response.raise_for_status()

image = Image.open(BytesIO(response.content))
h9.save(filename, image)
image.save(filename, format="JPEG")

shutil.copy(filename, f"storage/{filename}")

prompt = input()
flux_image(prompt, "hal9-flux.jpg")

0 comments on commit a571c76

Please sign in to comment.