BenkHel commited on
Commit
457103d
·
verified ·
1 Parent(s): 382115a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -55,7 +55,7 @@ tokenizer, model, image_processor, context_len = load_pretrained_model(
55
  model.config.training = False
56
 
57
  # FIXED PROMPT
58
- FIXED_PROMPT = "What material is this item and how to dispose of it?"
59
 
60
  def clear_history():
61
  state = default_conversation.copy()
@@ -66,9 +66,8 @@ def add_text(state, imagebox, textbox, image_process_mode):
66
  state = conv_templates[conv_mode].copy()
67
 
68
  if imagebox is not None:
69
- textbox = DEFAULT_IMAGE_TOKEN + '\n' + FIXED_PROMPT
70
  image = Image.open(imagebox).convert('RGB')
71
- if imagebox is not None:
72
  textbox = (textbox, image, image_process_mode)
73
  state.append_message(state.roles[0], textbox)
74
  state.append_message(state.roles[1], None)
@@ -213,7 +212,7 @@ with gr.Blocks(title="CuMo", theme=gr.themes.Default(), css=block_css) as demo:
213
 
214
  #cur_dir = os.path.dirname(os.path.abspath(__file__))
215
  cur_dir = './cumo/serve'
216
- default_prompt = "What material is this item and how to dispose of it?"
217
  gr.Examples(examples=[
218
  [f"{cur_dir}/examples/0165_CB.jpg", default_prompt],
219
  [f"{cur_dir}/examples/0225_PA.jpg", default_prompt],
 
55
  model.config.training = False
56
 
57
  # FIXED PROMPT
58
+ FIXED_PROMPT = "<image>\nWhat material is this item and how to dispose of it?"
59
 
60
  def clear_history():
61
  state = default_conversation.copy()
 
66
  state = conv_templates[conv_mode].copy()
67
 
68
  if imagebox is not None:
69
+ textbox = FIXED_PROMPT
70
  image = Image.open(imagebox).convert('RGB')
 
71
  textbox = (textbox, image, image_process_mode)
72
  state.append_message(state.roles[0], textbox)
73
  state.append_message(state.roles[1], None)
 
212
 
213
  #cur_dir = os.path.dirname(os.path.abspath(__file__))
214
  cur_dir = './cumo/serve'
215
+ default_prompt = "<image>\nWhat material is this item and how to dispose of it?"
216
  gr.Examples(examples=[
217
  [f"{cur_dir}/examples/0165_CB.jpg", default_prompt],
218
  [f"{cur_dir}/examples/0225_PA.jpg", default_prompt],