krishbakshi's picture
Update app.py
d1b4bf4 verified
raw
history blame
783 Bytes
from diffusers import DiffusionPipeline
import gradio as gr
import numpy as np
import os
from huggingface_hub import login
login(token= os.get('black-forest-labs/FLUX.1'))
# Define a function that takes a text input and returns an image.
def text_to_image(text : str):
pipe = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-dev")
pipe.load_lora_weights("gokaygokay/Flux-Game-Assets-LoRA-v2")
prompt = text
image = pipe(prompt).images[0]
return image
# Create a Gradio interface that takes a textbox input, runs it through the text_to_image function, and returns output to an image.
demo = gr.Interface(fn=text_to_image, inputs="textbox", outputs="image")
# Launch the interface.
if __name__ == "__main__":
demo.launch(show_error=True)