Spaces:
Running
Running
changes in UI
Browse files
app.py
CHANGED
@@ -15,16 +15,21 @@ caption_model = get_model()
|
|
15 |
|
16 |
|
17 |
def predict():
|
|
|
18 |
pred_caption = generate_caption('tmp.jpg', caption_model)
|
19 |
|
20 |
-
st.
|
21 |
-
|
22 |
|
23 |
for _ in range(4):
|
24 |
pred_caption = generate_caption('tmp.jpg', caption_model, add_noise=True)
|
25 |
-
|
26 |
-
|
|
|
|
|
|
|
27 |
|
|
|
28 |
img_url = st.text_input(label='Enter Image URL')
|
29 |
|
30 |
if (img_url != "") and (img_url != None):
|
@@ -37,6 +42,7 @@ if (img_url != "") and (img_url != None):
|
|
37 |
os.remove('tmp.jpg')
|
38 |
|
39 |
|
|
|
40 |
img = st.file_uploader(label='Upload Image', type=['jpg', 'png'])
|
41 |
|
42 |
if img != None:
|
|
|
15 |
|
16 |
|
17 |
def predict():
|
18 |
+
captions = []
|
19 |
pred_caption = generate_caption('tmp.jpg', caption_model)
|
20 |
|
21 |
+
st.markdown('#### Predicted Captions:')
|
22 |
+
captions.append(pred_caption)
|
23 |
|
24 |
for _ in range(4):
|
25 |
pred_caption = generate_caption('tmp.jpg', caption_model, add_noise=True)
|
26 |
+
if pred_caption not in captions:
|
27 |
+
captions.append(pred_caption)
|
28 |
+
|
29 |
+
for c in captions:
|
30 |
+
st.write(c)
|
31 |
|
32 |
+
st.title('Image Captioner')
|
33 |
img_url = st.text_input(label='Enter Image URL')
|
34 |
|
35 |
if (img_url != "") and (img_url != None):
|
|
|
42 |
os.remove('tmp.jpg')
|
43 |
|
44 |
|
45 |
+
st.markdown('<center style="opacity: 70%">OR</center>', unsafe_allow_html=True)
|
46 |
img = st.file_uploader(label='Upload Image', type=['jpg', 'png'])
|
47 |
|
48 |
if img != None:
|
tmp.jpg
DELETED
Binary file (12 kB)
|
|