Spaces:
Running
on
Zero
Running
on
Zero
update
Browse files- hf_demo.py +5 -4
- inference.py +2 -0
hf_demo.py
CHANGED
|
@@ -116,10 +116,10 @@ with block:
|
|
| 116 |
with gr.Row():
|
| 117 |
text = gr.Textbox(
|
| 118 |
label="Enter your prompt (long and detailed would be better):",
|
| 119 |
-
max_lines=
|
| 120 |
placeholder="Enter your prompt (long and detailed would be better)",
|
| 121 |
container=True,
|
| 122 |
-
value="
|
| 123 |
)
|
| 124 |
|
| 125 |
with gr.Tab('Generation'):
|
|
@@ -165,6 +165,7 @@ with block:
|
|
| 165 |
elem_id="gallery",
|
| 166 |
height="auto",
|
| 167 |
scale=1,
|
|
|
|
| 168 |
)
|
| 169 |
with gr.Column(scale=2):
|
| 170 |
with gr.Row():
|
|
@@ -193,8 +194,8 @@ with block:
|
|
| 193 |
)
|
| 194 |
start_timestep = gr.Slider(label="Adapter Timestep", minimum=0, maximum=1000, value=800, step=1)
|
| 195 |
with gr.Row():
|
| 196 |
-
btn_style_ori = gr.Button("Art-Free
|
| 197 |
-
btn_style_art = gr.Button("Artistic
|
| 198 |
|
| 199 |
|
| 200 |
with gr.Row():
|
|
|
|
| 116 |
with gr.Row():
|
| 117 |
text = gr.Textbox(
|
| 118 |
label="Enter your prompt (long and detailed would be better):",
|
| 119 |
+
max_lines=10,
|
| 120 |
placeholder="Enter your prompt (long and detailed would be better)",
|
| 121 |
container=True,
|
| 122 |
+
value="A blue bench situated in a park, surrounded by trees and leaves. The bench is positioned under a tree, providing shade and a peaceful atmosphere. There are several benches in the park, with one being closer to the foreground and the others further in the background. A person can be seen in the distance, possibly enjoying the park or taking a walk. The overall scene is serene and inviting, with the bench serving as a focal point in the park's landscape.",
|
| 123 |
)
|
| 124 |
|
| 125 |
with gr.Tab('Generation'):
|
|
|
|
| 165 |
elem_id="gallery",
|
| 166 |
height="auto",
|
| 167 |
scale=1,
|
| 168 |
+
value="data/003904765.jpg"
|
| 169 |
)
|
| 170 |
with gr.Column(scale=2):
|
| 171 |
with gr.Row():
|
|
|
|
| 194 |
)
|
| 195 |
start_timestep = gr.Slider(label="Adapter Timestep", minimum=0, maximum=1000, value=800, step=1)
|
| 196 |
with gr.Row():
|
| 197 |
+
btn_style_ori = gr.Button("Art-Free Stylize", scale=1)
|
| 198 |
+
btn_style_art = gr.Button("Artistic Stylize", scale=1)
|
| 199 |
|
| 200 |
|
| 201 |
with gr.Row():
|
inference.py
CHANGED
|
@@ -38,6 +38,7 @@ from custom_datasets import get_dataset
|
|
| 38 |
from diffusers.utils.torch_utils import randn_tensor
|
| 39 |
import pickle
|
| 40 |
import time
|
|
|
|
| 41 |
def flush():
|
| 42 |
torch.cuda.empty_cache()
|
| 43 |
gc.collect()
|
|
@@ -233,6 +234,7 @@ def inference(network: LoRANetwork, tokenizer: CLIPTokenizer, text_encoder: CLIP
|
|
| 233 |
dataloader, height:int, width:int, scales:list = np.linspace(0,2,5),save_dir:str=None, seed:int = None,
|
| 234 |
weight_dtype: torch.dtype = torch.float32, device: torch.device="cuda", batch_size:int=1, steps:int=50, guidance_scale:float=7.5, start_noise:int=800,
|
| 235 |
uncond_prompt:str=None, uncond_embed=None, style_prompt = None, show:bool = False, no_load:bool=False, from_scratch=False):
|
|
|
|
| 236 |
print(f"save dir: {save_dir}")
|
| 237 |
if start_noise < 0:
|
| 238 |
assert from_scratch
|
|
|
|
| 38 |
from diffusers.utils.torch_utils import randn_tensor
|
| 39 |
import pickle
|
| 40 |
import time
|
| 41 |
+
from datetime import datetime
|
| 42 |
def flush():
|
| 43 |
torch.cuda.empty_cache()
|
| 44 |
gc.collect()
|
|
|
|
| 234 |
dataloader, height:int, width:int, scales:list = np.linspace(0,2,5),save_dir:str=None, seed:int = None,
|
| 235 |
weight_dtype: torch.dtype = torch.float32, device: torch.device="cuda", batch_size:int=1, steps:int=50, guidance_scale:float=7.5, start_noise:int=800,
|
| 236 |
uncond_prompt:str=None, uncond_embed=None, style_prompt = None, show:bool = False, no_load:bool=False, from_scratch=False):
|
| 237 |
+
print(f"current time: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
|
| 238 |
print(f"save dir: {save_dir}")
|
| 239 |
if start_noise < 0:
|
| 240 |
assert from_scratch
|