Update app.py
Browse files
app.py
CHANGED
|
@@ -92,6 +92,7 @@ with st.form("app", clear_on_submit = True):
|
|
| 92 |
image_col.header("Image")
|
| 93 |
caption_text.header("Generated Caption")
|
| 94 |
image_col.image(image.resize((252,252)), use_column_width = True)
|
|
|
|
| 95 |
|
| 96 |
if 'init_model_required' not in st.session_state:
|
| 97 |
with st.spinner('Initializing model...'):
|
|
@@ -120,7 +121,7 @@ with st.form("app", clear_on_submit = True):
|
|
| 120 |
pixel_values = inputs.pixel_values
|
| 121 |
|
| 122 |
#Predict the caption for the imahe
|
| 123 |
-
generated_ids = model.generate(pixel_values = pixel_values, max_length =
|
| 124 |
generated_caption = processor.batch_decode(generated_ids, skip_special_tokens = True)[0]
|
| 125 |
|
| 126 |
#Output the predict text
|
|
|
|
| 92 |
image_col.header("Image")
|
| 93 |
caption_text.header("Generated Caption")
|
| 94 |
image_col.image(image.resize((252,252)), use_column_width = True)
|
| 95 |
+
caption_text.text("")
|
| 96 |
|
| 97 |
if 'init_model_required' not in st.session_state:
|
| 98 |
with st.spinner('Initializing model...'):
|
|
|
|
| 121 |
pixel_values = inputs.pixel_values
|
| 122 |
|
| 123 |
#Predict the caption for the imahe
|
| 124 |
+
generated_ids = model.generate(pixel_values = pixel_values, max_length = 10)
|
| 125 |
generated_caption = processor.batch_decode(generated_ids, skip_special_tokens = True)[0]
|
| 126 |
|
| 127 |
#Output the predict text
|