realitystar commited on
Commit
09ac675
·
verified ·
1 Parent(s): 66d267e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -26,7 +26,7 @@ def llava(message, history):
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"]
@@ -36,7 +36,10 @@ def llava(message, history):
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
 
 
 
40
 
41
  def extract_text_from_webpage(html_content):
42
  soup = BeautifulSoup(html_content, 'html.parser')
 
26
  image = message["files"][0]
27
  else:
28
  for hist in history:
29
+ if isinstance(hist[0], tuple):
30
  image = hist[0][0]
31
 
32
  txt = message["text"]
 
36
  prompt = f"<|im_start|>user <image>\n{txt}<|im_end|><|im_start|>assistant"
37
 
38
  inputs = processor(prompt, image, return_tensors="pt")
39
+
40
+ # Return the dictionary format expected by MultimodalTextbox
41
+ return {"text": txt, "files": [image]}
42
+
43
 
44
  def extract_text_from_webpage(html_content):
45
  soup = BeautifulSoup(html_content, 'html.parser')