realitystar
commited on
Update app.py
Browse files
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
|
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 |
-
|
|
|
|
|
|
|
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')
|