Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -40,10 +40,10 @@ def image_preprocess(image):
|
|
40 |
return image
|
41 |
|
42 |
def generate_caption(processor, model, device, image):
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
caption="im here "
|
47 |
return caption
|
48 |
|
49 |
def main():
|
|
|
40 |
return image
|
41 |
|
42 |
def generate_caption(processor, model, device, image):
|
43 |
+
inputs = image_processor (image, return_tensors='pt').to(device)
|
44 |
+
out = model.generate(**inputs, max_new_tokens=20)
|
45 |
+
caption = processor.decode(out[0], skip_special_tokens=True)
|
46 |
+
#caption="im here "
|
47 |
return caption
|
48 |
|
49 |
def main():
|