multimodalart HF staff commited on
Commit
61a562d
·
1 Parent(s): ed4c74d

Update script.py

Browse files
Files changed (1) hide show
  1. script.py +2 -1
script.py CHANGED
@@ -40,6 +40,7 @@ def do_inference(dataset_name, output_dir, num_tokens):
40
  pipe.load_textual_inversion(state_dict["clip_g"], token=tokens_list, text_encoder=pipe.text_encoder_2, tokenizer=pipe.tokenizer_2)
41
 
42
  prompts = [prompt.replace("TOK", tokens_sequence) for prompt in prompts]
 
43
  for i, prompt in enumerate(prompts):
44
  image = pipe(prompt, num_inference_steps=25, guidance_scale=7.5).images[0]
45
  filename = f"image-{i}.png"
@@ -51,7 +52,7 @@ def do_inference(dataset_name, output_dir, num_tokens):
51
  '{filename}'"""
52
  with open(f'{output_dir}/README.md', 'r') as file:
53
  readme_content = file.read()
54
-
55
  updated_readme_content = re.sub(r'(widget:\n)(.*?)(?=\n\S+:)', f'\\1{card_string}', readme_content, flags=re.DOTALL)
56
  print("Images generated!")
57
  with open('README.md', 'w') as file:
 
40
  pipe.load_textual_inversion(state_dict["clip_g"], token=tokens_list, text_encoder=pipe.text_encoder_2, tokenizer=pipe.tokenizer_2)
41
 
42
  prompts = [prompt.replace("TOK", tokens_sequence) for prompt in prompts]
43
+
44
  for i, prompt in enumerate(prompts):
45
  image = pipe(prompt, num_inference_steps=25, guidance_scale=7.5).images[0]
46
  filename = f"image-{i}.png"
 
52
  '{filename}'"""
53
  with open(f'{output_dir}/README.md', 'r') as file:
54
  readme_content = file.read()
55
+
56
  updated_readme_content = re.sub(r'(widget:\n)(.*?)(?=\n\S+:)', f'\\1{card_string}', readme_content, flags=re.DOTALL)
57
  print("Images generated!")
58
  with open('README.md', 'w') as file: