KingNish commited on
Commit
f0b6227
1 Parent(s): 06bea5a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -23,17 +23,17 @@ model.to("cpu")
23
 
24
  def llava(message, history):
25
  if message["files"]:
26
- image = user_prompt["files"][0]
27
  else:
28
  for hist in history:
29
  if type(hist[0])==tuple:
30
  image = hist[0][0]
31
 
32
- txt = user_prompt["text"]
33
 
34
  gr.Info("Analyzing image")
35
  image = Image.open(image).convert("RGB")
36
- prompt = f"<|im_start|>user <image>\n{user_prompt}<|im_end|><|im_start|>assistant"
37
 
38
  inputs = processor(prompt, image, return_tensors="pt")
39
  return inputs
 
23
 
24
  def llava(message, history):
25
  if message["files"]:
26
+ image = message["files"][0]
27
  else:
28
  for hist in history:
29
  if type(hist[0])==tuple:
30
  image = hist[0][0]
31
 
32
+ txt = message["text"]
33
 
34
  gr.Info("Analyzing image")
35
  image = Image.open(image).convert("RGB")
36
+ prompt = f"<|im_start|>user <image>\n{txt}<|im_end|><|im_start|>assistant"
37
 
38
  inputs = processor(prompt, image, return_tensors="pt")
39
  return inputs