Spaces:
Running
on
Zero
Running
on
Zero
Update src/paligemma/response.py
Browse files
src/paligemma/response.py
CHANGED
@@ -39,13 +39,11 @@ def caption_image(image: PIL.Image.Image, max_new_tokens: int, language: str) ->
|
|
39 |
try:
|
40 |
# Check if image is None
|
41 |
if not image:
|
42 |
-
gr.
|
43 |
|
44 |
# Prepare the inputs
|
45 |
language = language_dict[language]
|
46 |
-
print(language)
|
47 |
prompt = f"<image>caption {language}"
|
48 |
-
print(prompt)
|
49 |
model_inputs = (
|
50 |
processor(text=prompt, images=image, return_tensors="pt")
|
51 |
.to(torch.bfloat16)
|
|
|
39 |
try:
|
40 |
# Check if image is None
|
41 |
if not image:
|
42 |
+
gr.Error("Please provide an image.")
|
43 |
|
44 |
# Prepare the inputs
|
45 |
language = language_dict[language]
|
|
|
46 |
prompt = f"<image>caption {language}"
|
|
|
47 |
model_inputs = (
|
48 |
processor(text=prompt, images=image, return_tensors="pt")
|
49 |
.to(torch.bfloat16)
|