Spaces:
Sleeping
Sleeping
Update app.py
Browse filesAdded multiple flexibility
app.py
CHANGED
|
@@ -18,7 +18,6 @@ pipe = DiffusionPipeline.from_pretrained("sayakpaul/FLUX.1-merged", torch_dtype=
|
|
| 18 |
MAX_SEED = np.iinfo(np.int32).max
|
| 19 |
MAX_IMAGE_SIZE = 2048
|
| 20 |
|
| 21 |
-
|
| 22 |
def inferee(prompt, seed=42, randomize_seed=True, width=400, height=400, guidance_scale=3.5, num_inference_steps=8):
|
| 23 |
if randomize_seed:
|
| 24 |
seed = random.randint(0, MAX_SEED)
|
|
@@ -33,10 +32,21 @@ def inferee(prompt, seed=42, randomize_seed=True, width=400, height=400, guidanc
|
|
| 33 |
).images[0]
|
| 34 |
return image, seed
|
| 35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
interface = gr.Interface(
|
| 37 |
fn=inferee,
|
| 38 |
-
inputs=[
|
| 39 |
-
outputs=[
|
| 40 |
)
|
| 41 |
|
| 42 |
interface.launch()
|
|
|
|
| 18 |
MAX_SEED = np.iinfo(np.int32).max
|
| 19 |
MAX_IMAGE_SIZE = 2048
|
| 20 |
|
|
|
|
| 21 |
def inferee(prompt, seed=42, randomize_seed=True, width=400, height=400, guidance_scale=3.5, num_inference_steps=8):
|
| 22 |
if randomize_seed:
|
| 23 |
seed = random.randint(0, MAX_SEED)
|
|
|
|
| 32 |
).images[0]
|
| 33 |
return image, seed
|
| 34 |
|
| 35 |
+
prompt = gr.Text(
|
| 36 |
+
label="Prompt",
|
| 37 |
+
show_label=False,
|
| 38 |
+
max_lines=1,
|
| 39 |
+
placeholder="Enter your prompt",
|
| 40 |
+
container=False)
|
| 41 |
+
|
| 42 |
+
run_button = gr.Button("Run", scale=0)
|
| 43 |
+
|
| 44 |
+
result = gr.Image(label="Result", show_label=False)
|
| 45 |
+
|
| 46 |
interface = gr.Interface(
|
| 47 |
fn=inferee,
|
| 48 |
+
inputs=[prompt],
|
| 49 |
+
outputs=[result]
|
| 50 |
)
|
| 51 |
|
| 52 |
interface.launch()
|