aifeifei798 commited on
Commit
7286e79
·
verified ·
1 Parent(s): 0d45a57

Update feifeiui/feifeiui.py

Browse files
Files changed (1) hide show
  1. feifeiui/feifeiui.py +75 -4
feifeiui/feifeiui.py CHANGED
@@ -5,6 +5,7 @@ import config
5
  from feifeilib.feifeichat import feifeichat
6
  from feifeilib.feifeitexttoimg import feifeitexttoimg
7
  from feifeilib.feifeiflorence import feifeiflorence
 
8
 
9
  MAX_SEED = np.iinfo(np.int32).max
10
  MAX_IMAGE_SIZE = 2048
@@ -21,7 +22,7 @@ def create_ui():
21
  with gr.Blocks(css=css) as FeiFei:
22
  with gr.Row():
23
  with gr.Column(scale=1):
24
- with gr.Tab("Generator"):
25
  prompt = gr.Text(
26
  label="Prompt",
27
  show_label=False,
@@ -29,7 +30,7 @@ def create_ui():
29
  max_lines=12,
30
  container=False,
31
  )
32
- run_button = gr.Button("Run")
33
  result = gr.Image(label="Result",
34
  show_label=False,
35
  interactive=False)
@@ -115,6 +116,70 @@ def create_ui():
115
  output_img = gr.Image(label="Input Picture",
116
  interactive=False,
117
  show_label=False)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  with gr.Column(scale=3, elem_id="col-container"):
119
  gr.ChatInterface(
120
  feifeichat,
@@ -141,7 +206,7 @@ def create_ui():
141
  ],
142
  )
143
 
144
- run_button.click(
145
  fn=feifeitexttoimg, # Function to run for this button
146
  inputs=[
147
  prompt,
@@ -159,7 +224,13 @@ def create_ui():
159
  ],
160
  outputs=[result, seed],
161
  )
162
-
 
 
 
 
 
 
163
  florence_btn.click(
164
  fn=feifeiflorence, # Function to run when the button is clicked
165
  inputs=[input_img], # Input components for the function
 
5
  from feifeilib.feifeichat import feifeichat
6
  from feifeilib.feifeitexttoimg import feifeitexttoimg
7
  from feifeilib.feifeiflorence import feifeiflorence
8
+ from feifeilib.feifeifluxapi import feifeifluxapi
9
 
10
  MAX_SEED = np.iinfo(np.int32).max
11
  MAX_IMAGE_SIZE = 2048
 
22
  with gr.Blocks(css=css) as FeiFei:
23
  with gr.Row():
24
  with gr.Column(scale=1):
25
+ with gr.Tab("FeiFei"):
26
  prompt = gr.Text(
27
  label="Prompt",
28
  show_label=False,
 
30
  max_lines=12,
31
  container=False,
32
  )
33
+ feifei_button = gr.Button("FeiFei")
34
  result = gr.Image(label="Result",
35
  show_label=False,
36
  interactive=False)
 
116
  output_img = gr.Image(label="Input Picture",
117
  interactive=False,
118
  show_label=False)
119
+ with gr.Tab("Flux"):
120
+ flux_prompt = gr.Text(
121
+ label="Prompt",
122
+ show_label=False,
123
+ placeholder="Enter your prompt",
124
+ max_lines=12,
125
+ container=False,
126
+ )
127
+ flux_button = gr.Button("Flux")
128
+ flux_result = gr.Image(label="Result",
129
+ show_label=False,
130
+ interactive=False)
131
+
132
+ with gr.Accordion("Advanced Settings", open=False):
133
+ flux_seed = gr.Slider(
134
+ label="Seed",
135
+ minimum=0,
136
+ maximum=MAX_SEED,
137
+ step=1,
138
+ value=0,
139
+ )
140
+
141
+ flux_randomize_seed = gr.Checkbox(label="Randomize seed",
142
+ value=True)
143
+
144
+ with gr.Row():
145
+ flux_width = gr.Slider(
146
+ label="Width",
147
+ minimum=512,
148
+ maximum=MAX_IMAGE_SIZE,
149
+ step=64,
150
+ value=1088,
151
+ )
152
+
153
+ flux_height = gr.Slider(
154
+ label="Height",
155
+ minimum=512,
156
+ maximum=MAX_IMAGE_SIZE,
157
+ step=64,
158
+ value=1920,
159
+ )
160
+
161
+ with gr.Row():
162
+ flux_num_inference_steps = gr.Slider(
163
+ label="Number of inference steps",
164
+ minimum=1,
165
+ maximum=50,
166
+ step=1,
167
+ value=4,
168
+ )
169
+ flux_guidancescale = gr.Slider(
170
+ label="Guidance scale",
171
+ minimum=0,
172
+ maximum=10,
173
+ step=0.1,
174
+ value=3.5,
175
+ )
176
+ flux_num_strength = gr.Slider(
177
+ label="strength",
178
+ minimum=0,
179
+ maximum=2,
180
+ step=0.001,
181
+ value=0.035,
182
+ )
183
  with gr.Column(scale=3, elem_id="col-container"):
184
  gr.ChatInterface(
185
  feifeichat,
 
206
  ],
207
  )
208
 
209
+ feifei_button.click(
210
  fn=feifeitexttoimg, # Function to run for this button
211
  inputs=[
212
  prompt,
 
224
  ],
225
  outputs=[result, seed],
226
  )
227
+ flux_button.click(
228
+ fn=feifeifluxapi, # Function to run for this button
229
+ inputs=[
230
+ flux_prompt
231
+ ],
232
+ outputs=[flux_result],
233
+ )
234
  florence_btn.click(
235
  fn=feifeiflorence, # Function to run when the button is clicked
236
  inputs=[input_img], # Input components for the function