Severian commited on
Commit
ed82c48
·
verified ·
1 Parent(s): bbff0dc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -12,7 +12,7 @@ import torchvision.transforms.functional as TVF
12
 
13
 
14
  CLIP_PATH = "google/siglip-so400m-patch14-384"
15
- MODEL_PATH = "Qwen/Qwen2.5-7B-Instruct"
16
  CHECKPOINT_PATH = Path("9em124t2-499968")
17
  TITLE = "<h1><center>JoyCaption Alpha One (2024-09-20a)</center></h1>"
18
  CAPTION_TYPE_MAP = {
@@ -138,7 +138,7 @@ text_model.eval()
138
  # Image Adapter
139
  print("Loading image adapter")
140
  image_adapter = ImageAdapter(clip_model.config.hidden_size, text_model.config.hidden_size, False, False, 38, False)
141
- image_adapter.load_state_dict(torch.load(CHECKPOINT_PATH / "image_adapter.pt", map_location="cpu"))
142
  image_adapter.eval()
143
  image_adapter.to("cuda")
144
 
@@ -375,7 +375,7 @@ with gr.Blocks(theme="Hev832/Applio", css=css) as demo:
375
 
376
  1. **Pick a Picture**: Find a cool picture you want to talk about and upload it.
377
 
378
- 2. **Choose What You Want**:
379
  - **Caption Type**:
380
  * "Descriptive" tells you what's in the picture
381
  * "Training Prompt" helps computers make similar pictures
@@ -476,7 +476,7 @@ with gr.Blocks(theme="Hev832/Applio", css=css) as demo:
476
  gr.Markdown("**Note:** Caption tone doesn't affect `rng-tags`, `training_prompt`, and `style_prompt`.")
477
 
478
  run_button = gr.Button("Make My Caption!")
479
-
480
 
481
  def update_style_options(caption_type):
482
  return {
@@ -492,5 +492,6 @@ with gr.Blocks(theme="Hev832/Applio", css=css) as demo:
492
 
493
  run_button.click(fn=stream_chat, inputs=[input_image, caption_type, caption_tone, caption_length, lens_type, film_stock, composition_style, lighting_aspect, special_technique, color_effect], outputs=[output_caption])
494
 
 
495
  if __name__ == "__main__":
496
  demo.launch()
 
12
 
13
 
14
  CLIP_PATH = "google/siglip-so400m-patch14-384"
15
+ MODEL_PATH = "meta-llama/Meta-Llama-3.1-8B"
16
  CHECKPOINT_PATH = Path("9em124t2-499968")
17
  TITLE = "<h1><center>JoyCaption Alpha One (2024-09-20a)</center></h1>"
18
  CAPTION_TYPE_MAP = {
 
138
  # Image Adapter
139
  print("Loading image adapter")
140
  image_adapter = ImageAdapter(clip_model.config.hidden_size, text_model.config.hidden_size, False, False, 38, False)
141
+ image_adapter.load_state_dict(torch.load(CHECKPOINT_PATH / "image_adapter.pt", map_location="cpu", weights_only=True))
142
  image_adapter.eval()
143
  image_adapter.to("cuda")
144
 
 
375
 
376
  1. **Pick a Picture**: Find a cool picture you want to talk about and upload it.
377
 
378
+ 2. **Choose What You Want**:
379
  - **Caption Type**:
380
  * "Descriptive" tells you what's in the picture
381
  * "Training Prompt" helps computers make similar pictures
 
476
  gr.Markdown("**Note:** Caption tone doesn't affect `rng-tags`, `training_prompt`, and `style_prompt`.")
477
 
478
  run_button = gr.Button("Make My Caption!")
479
+
480
 
481
  def update_style_options(caption_type):
482
  return {
 
492
 
493
  run_button.click(fn=stream_chat, inputs=[input_image, caption_type, caption_tone, caption_length, lens_type, film_stock, composition_style, lighting_aspect, special_technique, color_effect], outputs=[output_caption])
494
 
495
+
496
  if __name__ == "__main__":
497
  demo.launch()