ZennyKenny commited on
Commit
eebddbb
·
verified ·
1 Parent(s): 3473819

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +62 -21
app.py CHANGED
@@ -58,7 +58,7 @@ def infer(prompt, seed=42, randomize_seed=False, width=1024, height=1024, guidan
58
 
59
 
60
  examples = [
61
- "a man walking a in the forest",
62
  "a viking ship sailing down a river",
63
  "a woman resting by an open fire",
64
  ]
@@ -70,29 +70,49 @@ css = """
70
  }
71
  """
72
 
73
- with gr.Blocks(css=css) as demo:
74
- with gr.Column(elem_id="col-container"):
75
- gr.Markdown("# FLUX.1 [Natalie LoRA]\nModel prompt-augmented with `XTON`, adapted from [FLUX.1-dev](https://huggingface.co/black-forest-labs/FLUX.1-dev)")
 
 
76
 
77
- with gr.Row():
78
- prompt = gr.Text(label="Prompt", show_label=False, max_lines=1, placeholder="Enter your prompt", container=False)
79
- run_button = gr.Button("Run", scale=0)
80
 
81
- result = gr.Image(label="Result", show_label=False)
82
-
83
- with gr.Accordion("Advanced Settings", open=False):
84
- seed = gr.Slider(label="Seed", minimum=0, maximum=MAX_SEED, step=1, value=0)
85
- randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
86
-
87
- with gr.Row():
88
- width = gr.Slider(label="Width", minimum=256, maximum=MAX_IMAGE_SIZE, step=32, value=1024)
89
- height = gr.Slider(label="Height", minimum=256, maximum=MAX_IMAGE_SIZE, step=32, value=1024)
90
 
91
  with gr.Row():
92
- guidance_scale = gr.Slider(label="Guidance Scale", minimum=1, maximum=15, step=0.1, value=3.5)
93
- num_inference_steps = gr.Slider(label="Number of inference steps", minimum=1, maximum=50, step=1, value=28)
94
-
95
- gr.Examples(examples=examples, fn=infer, inputs=[prompt], outputs=[result, seed], cache_examples="lazy")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
 
97
  gr.on(
98
  triggers=[run_button.click, prompt.submit],
@@ -101,5 +121,26 @@ with gr.Blocks(css=css) as demo:
101
  outputs=[result, seed],
102
  )
103
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
  if __name__ == "__main__":
105
- demo.launch()
 
58
 
59
 
60
  examples = [
61
+ "a man walking in the forest",
62
  "a viking ship sailing down a river",
63
  "a woman resting by an open fire",
64
  ]
 
70
  }
71
  """
72
 
73
+ with gr.Blocks(css=css) as natalie_diffusion:
74
+ with gr.Row():
75
+ with gr.Column(scale=1, elem_id="left-column"):
76
+ gr.Markdown("""
77
+ # ХТОНЬ: Natalie LoRA Image Generator
78
 
79
+ Generate images in the surreal style of artist [Natalie Kav](https://www.behance.net/nataliKav), adapted using a custom LoRA on the FLUX.1 [dev] model.
 
 
80
 
81
+ > This space is designed for prototyping concept art for a forthcoming game called **ХТОНЬ**. All outputs are generated locally in the browser using GPU acceleration.
82
+ """)
 
 
 
 
 
 
 
83
 
84
  with gr.Row():
85
+ prompt = gr.Text(
86
+ label="Prompt",
87
+ show_label=False,
88
+ max_lines=1,
89
+ placeholder="Enter your prompt...",
90
+ container=False,
91
+ )
92
+ run_button = gr.Button("🎨 Generate", scale=0)
93
+
94
+ with gr.Accordion("Advanced Settings", open=False):
95
+ seed = gr.Slider(label="Seed", minimum=0, maximum=MAX_SEED, step=1, value=0)
96
+ randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
97
+
98
+ with gr.Row():
99
+ width = gr.Slider(label="Width", minimum=256, maximum=MAX_IMAGE_SIZE, step=32, value=1024)
100
+ height = gr.Slider(label="Height", minimum=256, maximum=MAX_IMAGE_SIZE, step=32, value=1024)
101
+
102
+ with gr.Row():
103
+ guidance_scale = gr.Slider(label="Guidance Scale", minimum=1, maximum=15, step=0.1, value=3.5)
104
+ num_inference_steps = gr.Slider(label="Number of inference steps", minimum=1, maximum=50, step=1, value=28)
105
+
106
+ gr.Examples(
107
+ examples=examples,
108
+ fn=infer,
109
+ inputs=[prompt],
110
+ outputs=[result, seed],
111
+ cache_examples="lazy"
112
+ )
113
+
114
+ with gr.Column(scale=1, elem_id="right-column"):
115
+ result = gr.Image(label="", show_label=False, elem_id="generated-image")
116
 
117
  gr.on(
118
  triggers=[run_button.click, prompt.submit],
 
121
  outputs=[result, seed],
122
  )
123
 
124
+ css = """
125
+ #left-column {
126
+ padding: 1rem;
127
+ }
128
+
129
+ #right-column {
130
+ display: flex;
131
+ align-items: center;
132
+ justify-content: center;
133
+ padding: 1rem;
134
+ }
135
+
136
+ #generated-image > img {
137
+ border-radius: 12px;
138
+ box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.2);
139
+ max-width: 100%;
140
+ height: auto;
141
+ }
142
+ """
143
+
144
+
145
  if __name__ == "__main__":
146
+ natalie_diffusion.launch()