Update app.py
Browse files
app.py
CHANGED
@@ -23,7 +23,9 @@ def bot_streaming(message, history):
|
|
23 |
for hist in history:
|
24 |
if type(hist[0])==tuple:
|
25 |
image = hist[0][0]
|
26 |
-
|
|
|
|
|
27 |
prompt=f"[INST] <image>\n{message['text']} [/INST]"
|
28 |
image = Image.open(image).convert("RGB")
|
29 |
inputs = processor(prompt, image, return_tensors="pt").to("cuda:0")
|
|
|
23 |
for hist in history:
|
24 |
if type(hist[0])==tuple:
|
25 |
image = hist[0][0]
|
26 |
+
|
27 |
+
if image is None:
|
28 |
+
gr.Error("You need to upload an image for LLaVA to work.")
|
29 |
prompt=f"[INST] <image>\n{message['text']} [/INST]"
|
30 |
image = Image.open(image).convert("RGB")
|
31 |
inputs = processor(prompt, image, return_tensors="pt").to("cuda:0")
|