Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -23,17 +23,17 @@ model.to("cpu")
|
|
23 |
|
24 |
def llava(message, history):
|
25 |
if message["files"]:
|
26 |
-
image =
|
27 |
else:
|
28 |
for hist in history:
|
29 |
if type(hist[0])==tuple:
|
30 |
image = hist[0][0]
|
31 |
|
32 |
-
txt =
|
33 |
|
34 |
gr.Info("Analyzing image")
|
35 |
image = Image.open(image).convert("RGB")
|
36 |
-
prompt = f"<|im_start|>user <image>\n{
|
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
|