File size: 783 Bytes
94ff45f
c5c13ba
 
d1b4bf4
94ff45f
14c265d
 
d1b4bf4
 
94ff45f
c5c13ba
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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)