Spaces:
Running
on
Zero
Running
on
Zero
File size: 9,942 Bytes
62eb11a 7286e79 62eb11a 3a8e0ac 62eb11a ece4ec0 62eb11a ece4ec0 62eb11a 518b0f6 62eb11a 518b0f6 7286e79 518b0f6 62eb11a 518b0f6 ece4ec0 62eb11a 518b0f6 62eb11a 518b0f6 2dda2f2 62eb11a 518b0f6 ece4ec0 518b0f6 e0166e5 518b0f6 e0166e5 518b0f6 3218035 518b0f6 ece4ec0 62eb11a 3c6d834 518b0f6 7286e79 ece4ec0 3752c4b 7286e79 ece4ec0 7286e79 29e07c6 7286e79 29e07c6 7286e79 1a3043b 7286e79 ece4ec0 89bc4c4 518b0f6 982a67f 518b0f6 89bc4c4 518b0f6 ece4ec0 518b0f6 62eb11a 518b0f6 62eb11a 4b816d9 62eb11a 4b816d9 62eb11a 518b0f6 7fbd7a4 62eb11a 7286e79 62eb11a 31ef714 62eb11a 7286e79 29e07c6 168dff0 b3a5d68 7286e79 62eb11a e1a80e4 62eb11a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 |
import gradio as gr
import numpy as np
import config
from feifeilib.feifeichat import feifeichat
from feifeilib.feifeitexttoimg import feifeitexttoimg
from feifeilib.feifeiflorence import feifeiflorence
from feifeilib.feifeifluxapi import feifeifluxapi
MAX_SEED = np.iinfo(np.int32).max
MAX_IMAGE_SIZE = 2048
css = """
#col-container {
width: auto;
height: 895px;
}
"""
def create_ui():
with gr.Blocks(css=css) as FeiFei:
with gr.Row():
with gr.Column(scale=3):
with gr.Tab("FeiFei"):
with gr.Row():
with gr.Column(scale=1):
prompt = gr.Text(
label="Prompt",
show_label=False,
placeholder="Enter your prompt",
max_lines=12,
container=False,
)
feifei_button = gr.Button("FeiFei")
quality_select = gr.Checkbox(label="high quality")
sharpened_select = gr.Checkbox(label="Sharpened")
FooocusExpansion_select = gr.Checkbox(
label="FooocusExpansion")
styles_name = [
style["name"] for style in config.style_list
]
styles_Radio = gr.Dropdown(styles_name,
label="Styles",
multiselect=True)
seed = gr.Slider(
label="Seed",
minimum=0,
maximum=MAX_SEED,
step=1,
value=0,
)
randomize_seed = gr.Checkbox(label="Randomize seed",
value=True)
with gr.Row():
width = gr.Slider(
label="Width",
minimum=512,
maximum=MAX_IMAGE_SIZE,
step=64,
value=896,
)
height = gr.Slider(
label="Height",
minimum=512,
maximum=MAX_IMAGE_SIZE,
step=64,
value=1152,
)
with gr.Row():
num_inference_steps = gr.Slider(
label="Number of inference steps",
minimum=1,
maximum=50,
step=1,
value=6,
)
guidancescale = gr.Slider(
label="Guidance scale",
minimum=0,
maximum=10,
step=0.1,
value=3.5,
)
num_strength = gr.Slider(
label="strength",
minimum=0,
maximum=2,
step=0.001,
value=0.035,
)
with gr.Column(scale=3):
result = gr.Image(label="Result",
show_label=False,
interactive=False,
height=835)
with gr.Tab("DarkIdol"):
with gr.Row():
flux_prompt = gr.Text(
label="Prompt",
show_label=False,
placeholder="Enter your prompt",
max_lines=12,
container=False,
)
flux_button = gr.Button("Flux")
flux_result = gr.Image(label="Result",
show_label=False,
interactive=False,
height=520)
with gr.Accordion("Advanced Settings", open=False):
flux_seed = gr.Slider(
label="Seed",
minimum=0,
maximum=MAX_SEED,
step=1,
value=0,
)
flux_randomize_seed = gr.Checkbox(label="Randomize seed",
value=True)
with gr.Row():
flux_width = gr.Slider(
label="Width",
minimum=512,
maximum=MAX_IMAGE_SIZE,
step=64,
value=896,
)
flux_height = gr.Slider(
label="Height",
minimum=512,
maximum=MAX_IMAGE_SIZE,
step=64,
value=1152,
)
with gr.Row():
flux_num_inference_steps = gr.Slider(
label="Number of inference steps",
minimum=1,
maximum=50,
step=1,
value=4,
)
flux_guidancescale = gr.Slider(
label="Guidance scale",
minimum=0,
maximum=10,
step=0.1,
value=3.5,
)
flux_num_strength = gr.Slider(
label="strength",
minimum=0,
maximum=2,
step=0.001,
value=0.035,
)
with gr.Tab("GenPrompt"):
input_img = gr.Image(label="Input Picture",
show_label=False,
height=480,
type="filepath")
florence_btn = gr.Button(value="GenPrompt")
output_text = gr.Textbox(label="Output Text",
show_label=False,
container=False)
with gr.Column(scale=1, elem_id="col-container"):
gr.ChatInterface(
feifeichat,
type="messages",
multimodal=True,
additional_inputs=[
gr.Checkbox(label="Feifei", value=True),
gr.Dropdown(
["meta-llama/Llama-3.3-70B-Instruct",
"CohereForAI/c4ai-command-r-plus-08-2024",
"Qwen/Qwen2.5-72B-Instruct",
"nvidia/Llama-3.1-Nemotron-70B-Instruct-HF",
"NousResearch/Hermes-3-Llama-3.1-8B",
"mistralai/Mistral-Nemo-Instruct-2411",
"microsoft/Phi-3.5-mini-instruct"],
value="meta-llama/Llama-3.3-70B-Instruct",
show_label=False,
container=False),
gr.Radio(
["pixtral", "Vsiion"],
value="pixtral",
show_label=False,
container=False)
],
)
feifei_button.click(
fn=feifeitexttoimg, # Function to run for this button
inputs=[
prompt,
quality_select,
sharpened_select,
styles_Radio,
FooocusExpansion_select,
seed,
randomize_seed,
width,
height,
num_inference_steps,
guidancescale,
num_strength,
],
outputs=[result],
)
flux_button.click(
fn=feifeifluxapi, # Function to run for this button
inputs=[
flux_prompt,
flux_height,
flux_width,
flux_guidancescale
],
outputs=[flux_result],
)
florence_btn.click(
fn=feifeiflorence, # Function to run when the button is clicked
inputs=[input_img], # Input components for the function
outputs=[output_text], # Output component for the function
)
return FeiFei
|