Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -30,7 +30,7 @@ def image_preprocess(image):
|
|
30 |
image = image.convert("RGB")
|
31 |
return image
|
32 |
|
33 |
-
def generate_caption(image_processor, model, device, image):
|
34 |
inputs = image_processor(image, return_tensors='pt').to(device)
|
35 |
model.eval()
|
36 |
# Generate caption
|
@@ -64,12 +64,11 @@ def main():
|
|
64 |
if st.sidebar.button('Generate Caption'):
|
65 |
with st.spinner('Generating caption...'):
|
66 |
image_processor, model,tokenizer, device = initialize_model()
|
67 |
-
caption = generate_caption(image_processor, model, device, image)
|
68 |
|
69 |
st.header("Caption:")
|
70 |
st.markdown(f'**{caption}**')
|
71 |
|
72 |
-
|
73 |
if __name__ == '__main__':
|
74 |
main()
|
75 |
|
|
|
30 |
image = image.convert("RGB")
|
31 |
return image
|
32 |
|
33 |
+
def generate_caption(image_processor, model, tokenizer,device, image):
|
34 |
inputs = image_processor(image, return_tensors='pt').to(device)
|
35 |
model.eval()
|
36 |
# Generate caption
|
|
|
64 |
if st.sidebar.button('Generate Caption'):
|
65 |
with st.spinner('Generating caption...'):
|
66 |
image_processor, model,tokenizer, device = initialize_model()
|
67 |
+
caption = generate_caption(image_processor, model, tokenizer,device, image)
|
68 |
|
69 |
st.header("Caption:")
|
70 |
st.markdown(f'**{caption}**')
|
71 |
|
|
|
72 |
if __name__ == '__main__':
|
73 |
main()
|
74 |
|