JackAILab commited on
Commit
29219c0
·
verified ·
1 Parent(s): 7fa3b9e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -22
app.py CHANGED
@@ -45,18 +45,18 @@ bise_net.cuda()
45
 
46
  import sys
47
  sys.path.append("./models/LLaVA")
48
- from llava.model.builder import load_pretrained_model
49
- from llava.mm_utils import get_model_name_from_path
50
- from llava.eval.run_llava import eval_model
51
 
52
  # Load Llava for prompt enhancement
53
  llva_model_path = "liuhaotian/llava-v1.5-7b"
54
- llva_tokenizer, llva_model, llva_image_processor, llva_context_len = load_pretrained_model(
55
- model_path=llva_model_path,
56
- model_base=None,
57
- model_name=get_model_name_from_path(llva_model_path),)
58
  # llva_tokenizer.cuda()
59
- llva_model.to(device)
60
  # llva_image_processor.to(device)
61
 
62
  ### Load consistentID_model checkpoint
@@ -102,20 +102,20 @@ def process(selected_template_images,costum_image,prompt
102
  def Enhance_prompt(prompt,select_images):
103
 
104
  llva_prompt = f'Please ignore the image. Enhance the following text prompt for me. You can associate more details with the character\'s gesture, environment, and decent clothing:"{prompt}".'
105
- args = type('Args', (), {
106
- "model_path": llva_model_path,
107
- "model_base": None,
108
- "model_name": get_model_name_from_path(llva_model_path),
109
- "query": llva_prompt,
110
- "conv_mode": None,
111
- "image_file": select_images,
112
- "sep": ",",
113
- "temperature": 0,
114
- "top_p": None,
115
- "num_beams": 1,
116
- "max_new_tokens": 512
117
- })()
118
- Enhanced_prompt = eval_model(args, llva_tokenizer, llva_model, llva_image_processor)
119
 
120
  return Enhanced_prompt
121
 
 
45
 
46
  import sys
47
  sys.path.append("./models/LLaVA")
48
+ # from llava.model.builder import load_pretrained_model
49
+ # from llava.mm_utils import get_model_name_from_path
50
+ # from llava.eval.run_llava import eval_model
51
 
52
  # Load Llava for prompt enhancement
53
  llva_model_path = "liuhaotian/llava-v1.5-7b"
54
+ # llva_tokenizer, llva_model, llva_image_processor, llva_context_len = load_pretrained_model(
55
+ # model_path=llva_model_path,
56
+ # model_base=None,
57
+ # model_name=get_model_name_from_path(llva_model_path),)
58
  # llva_tokenizer.cuda()
59
+ # llva_model.to(device)
60
  # llva_image_processor.to(device)
61
 
62
  ### Load consistentID_model checkpoint
 
102
  def Enhance_prompt(prompt,select_images):
103
 
104
  llva_prompt = f'Please ignore the image. Enhance the following text prompt for me. You can associate more details with the character\'s gesture, environment, and decent clothing:"{prompt}".'
105
+ # args = type('Args', (), {
106
+ # "model_path": llva_model_path,
107
+ # "model_base": None,
108
+ # "model_name": get_model_name_from_path(llva_model_path),
109
+ # "query": llva_prompt,
110
+ # "conv_mode": None,
111
+ # "image_file": select_images,
112
+ # "sep": ",",
113
+ # "temperature": 0,
114
+ # "top_p": None,
115
+ # "num_beams": 1,
116
+ # "max_new_tokens": 512
117
+ # })()
118
+ # Enhanced_prompt = eval_model(args, llva_tokenizer, llva_model, llva_image_processor)
119
 
120
  return Enhanced_prompt
121