Update app.py
Browse files
app.py
CHANGED
|
@@ -39,10 +39,6 @@ def infer(prompt, seed=42, randomize_seed=False, width=1024, height=1024, num_in
|
|
| 39 |
if randomize_seed:
|
| 40 |
seed = random.randint(0, MAX_SEED)
|
| 41 |
generator = torch.Generator().manual_seed(seed)
|
| 42 |
-
prompt = re.sub("girl", " feifei, A beautiful, 18 yo kpop idol, large-busted Japanese girl, with light makeup, gazing deeply into the camera, " ,prompt)
|
| 43 |
-
prompt = re.sub("young woman", " feifei, A beautiful, 18 yo kpop idol, large-busted Japanese girl, with light makeup, gazing deeply into the camera, " ,prompt)
|
| 44 |
-
prompt = re.sub("woman", " feifei, A beautiful, 18 yo kpop idol, large-busted Japanese girl, with light makeup, gazing deeply into the camera, " ,prompt)
|
| 45 |
-
prompt = re.sub("model", " feifei, A beautiful, 18 yo kpop idol, large-busted Japanese girl, with light makeup, gazing deeply into the camera, " ,prompt)
|
| 46 |
pipe.set_adapters(
|
| 47 |
["feifei"],
|
| 48 |
adapter_weights=[num_feifei],
|
|
@@ -61,10 +57,10 @@ def infer(prompt, seed=42, randomize_seed=False, width=1024, height=1024, num_in
|
|
| 61 |
generator = generator,
|
| 62 |
guidance_scale=guidancescale
|
| 63 |
).images[0]
|
| 64 |
-
return image, seed
|
| 65 |
|
| 66 |
examples = [
|
| 67 |
-
"this photo is a girl"
|
| 68 |
]
|
| 69 |
|
| 70 |
css="""
|
|
@@ -105,15 +101,7 @@ with gr.Blocks(css=css) as demo:
|
|
| 105 |
)
|
| 106 |
|
| 107 |
randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
|
| 108 |
-
|
| 109 |
-
out_prompt = gr.Text(
|
| 110 |
-
label="Prompt",
|
| 111 |
-
show_label=False,
|
| 112 |
-
max_lines=12,
|
| 113 |
-
placeholder="this photo prompt",
|
| 114 |
-
value="",
|
| 115 |
-
container=False,
|
| 116 |
-
)
|
| 117 |
with gr.Row():
|
| 118 |
|
| 119 |
width = gr.Slider(
|
|
@@ -171,7 +159,7 @@ with gr.Blocks(css=css) as demo:
|
|
| 171 |
triggers=[run_button.click, prompt.submit],
|
| 172 |
fn = infer,
|
| 173 |
inputs = [prompt, seed, randomize_seed, width, height, num_inference_steps, guidancescale, num_feifei],
|
| 174 |
-
outputs = [result, seed
|
| 175 |
)
|
| 176 |
|
| 177 |
demo.launch()
|
|
|
|
| 39 |
if randomize_seed:
|
| 40 |
seed = random.randint(0, MAX_SEED)
|
| 41 |
generator = torch.Generator().manual_seed(seed)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
pipe.set_adapters(
|
| 43 |
["feifei"],
|
| 44 |
adapter_weights=[num_feifei],
|
|
|
|
| 57 |
generator = generator,
|
| 58 |
guidance_scale=guidancescale
|
| 59 |
).images[0]
|
| 60 |
+
return image, seed
|
| 61 |
|
| 62 |
examples = [
|
| 63 |
+
"this photo is a kpop girl"
|
| 64 |
]
|
| 65 |
|
| 66 |
css="""
|
|
|
|
| 101 |
)
|
| 102 |
|
| 103 |
randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
|
| 104 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
with gr.Row():
|
| 106 |
|
| 107 |
width = gr.Slider(
|
|
|
|
| 159 |
triggers=[run_button.click, prompt.submit],
|
| 160 |
fn = infer,
|
| 161 |
inputs = [prompt, seed, randomize_seed, width, height, num_inference_steps, guidancescale, num_feifei],
|
| 162 |
+
outputs = [result, seed]
|
| 163 |
)
|
| 164 |
|
| 165 |
demo.launch()
|