Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import random
|
| 3 |
-
|
| 4 |
|
| 5 |
model = gr.load("models/black-forest-labs/FLUX.1-schnell")
|
| 6 |
|
|
@@ -8,15 +8,13 @@ def generate_image(text, seed, width, height, guidance_scale, num_inference_step
|
|
| 8 |
if seed is not None:
|
| 9 |
random.seed(seed)
|
| 10 |
|
| 11 |
-
if text in [example[0] for example in examples]:
|
| 12 |
-
print(f"Using example: {text}")
|
| 13 |
-
|
| 14 |
result_image = model(text)
|
| 15 |
|
| 16 |
print(f"Width: {width}, Height: {height}, Guidance Scale: {guidance_scale}, Inference Steps: {num_inference_steps}")
|
| 17 |
|
| 18 |
return result_image
|
| 19 |
|
|
|
|
| 20 |
def randomize_parameters():
|
| 21 |
seed = random.randint(0, 999999)
|
| 22 |
width = random.randint(512, 2048)
|
|
@@ -26,6 +24,7 @@ def randomize_parameters():
|
|
| 26 |
|
| 27 |
return seed, width, height, guidance_scale, num_inference_steps
|
| 28 |
|
|
|
|
| 29 |
interface = gr.Interface(
|
| 30 |
fn=generate_image,
|
| 31 |
inputs=[
|
|
@@ -40,4 +39,5 @@ interface = gr.Interface(
|
|
| 40 |
description="Sorry for the inconvenience. The model is currently running on the CPU, which might affect performance. We appreciate your understanding.",
|
| 41 |
)
|
| 42 |
|
|
|
|
| 43 |
interface.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import random
|
| 3 |
+
|
| 4 |
|
| 5 |
model = gr.load("models/black-forest-labs/FLUX.1-schnell")
|
| 6 |
|
|
|
|
| 8 |
if seed is not None:
|
| 9 |
random.seed(seed)
|
| 10 |
|
|
|
|
|
|
|
|
|
|
| 11 |
result_image = model(text)
|
| 12 |
|
| 13 |
print(f"Width: {width}, Height: {height}, Guidance Scale: {guidance_scale}, Inference Steps: {num_inference_steps}")
|
| 14 |
|
| 15 |
return result_image
|
| 16 |
|
| 17 |
+
|
| 18 |
def randomize_parameters():
|
| 19 |
seed = random.randint(0, 999999)
|
| 20 |
width = random.randint(512, 2048)
|
|
|
|
| 24 |
|
| 25 |
return seed, width, height, guidance_scale, num_inference_steps
|
| 26 |
|
| 27 |
+
|
| 28 |
interface = gr.Interface(
|
| 29 |
fn=generate_image,
|
| 30 |
inputs=[
|
|
|
|
| 39 |
description="Sorry for the inconvenience. The model is currently running on the CPU, which might affect performance. We appreciate your understanding.",
|
| 40 |
)
|
| 41 |
|
| 42 |
+
|
| 43 |
interface.launch()
|