Spaces:
Running
Running
added gradio
Browse files
app.py
CHANGED
@@ -1,7 +1,21 @@
|
|
1 |
from diffusers import DiffusionPipeline
|
|
|
|
|
2 |
|
3 |
-
pipe = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-dev")
|
4 |
-
pipe.load_lora_weights("gokaygokay/Flux-Game-Assets-LoRA-v2")
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
from diffusers import DiffusionPipeline
|
2 |
+
import gradio as gr
|
3 |
+
import numpy as np
|
4 |
|
|
|
|
|
5 |
|
6 |
+
# Define a function that takes a text input and returns an image.
|
7 |
+
def text_to_image(text : str):
|
8 |
+
pipe = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-dev")
|
9 |
+
pipe.load_lora_weights("gokaygokay/Flux-Game-Assets-LoRA-v2")
|
10 |
+
|
11 |
+
prompt = text
|
12 |
+
image = pipe(prompt).images[0]
|
13 |
+
return image
|
14 |
+
|
15 |
+
# Create a Gradio interface that takes a textbox input, runs it through the text_to_image function, and returns output to an image.
|
16 |
+
demo = gr.Interface(fn=text_to_image, inputs="textbox", outputs="image")
|
17 |
+
|
18 |
+
# Launch the interface.
|
19 |
+
if __name__ == "__main__":
|
20 |
+
demo.launch(show_error=True)
|
21 |
+
|