Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,29 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from huggingface_hub import InferenceClient
|
| 3 |
|
| 4 |
+
# Define the inference function
|
| 5 |
+
def generate_image(prompt, seed, denoise):
|
| 6 |
+
client = InferenceClient(model="tryonlabs/FLUX.1-dev-LoRA-Lehenga-Generator")
|
| 7 |
+
# Assuming the model accepts these parameters; adjust based on actual API
|
| 8 |
+
image = client.text_to_image(
|
| 9 |
+
prompt=prompt,
|
| 10 |
+
seed=seed if seed >= 0 else None, # Use -1 for random seed
|
| 11 |
+
denoise=denoise # Denoising strength, typically between 0 and 1
|
| 12 |
+
)
|
| 13 |
+
return image
|
| 14 |
+
|
| 15 |
+
# Create the Gradio interface with advanced options
|
| 16 |
+
interface = gr.Interface(
|
| 17 |
+
fn=generate_image,
|
| 18 |
+
inputs=[
|
| 19 |
+
gr.Textbox(label="Prompt", placeholder="Enter your prompt here..."),
|
| 20 |
+
gr.Slider(label="Seed", minimum=-1, maximum=1000000, step=1, value=-1, info="Set to -1 for random seed"),
|
| 21 |
+
gr.Slider(label="Denoise Strength", minimum=0.0, maximum=1.0, step=0.01, value=0.8, info="Controls noise reduction (0 to 1)")
|
| 22 |
+
],
|
| 23 |
+
outputs=gr.Image(label="Generated Lehenga Image"),
|
| 24 |
+
title="FLUX.1-dev Lehenga Generator",
|
| 25 |
+
description="Generate custom Lehenga designs using FLUX.1-dev with LoRA. Adjust seed and denoise for control.",
|
| 26 |
+
)
|
| 27 |
+
|
| 28 |
+
# Launch the interface
|
| 29 |
+
interface.launch()
|