ydshieh commited on
Commit
cc62e3c
·
1 Parent(s): 2cd4a71

add en translation

Browse files
Files changed (1) hide show
  1. app.py +9 -6
app.py CHANGED
@@ -27,7 +27,7 @@ with st.spinner('Loading and compiling ViT-GPT2 model ...'):
27
  st.sidebar.title("Select a sample image")
28
 
29
  sample_name = st.sidebar.selectbox(
30
- "Please Choose the Model",
31
  sample_fns
32
  )
33
 
@@ -45,10 +45,13 @@ with st.spinner('Generating image caption ...'):
45
 
46
  caption = predict(image)
47
  image.close()
48
- caption_en = translator.translate(caption, src='fr', dest='en')
49
- st.header('**Prediction**:')
50
- st.subheader(f'{caption}\n')
51
- st.subheader(f'**English Translation**: {caption_en}\n')
52
 
53
  st.sidebar.header("ViT-GPT2 predicts:")
54
- st.sidebar.write(f"{caption}", '\n')
 
 
 
 
 
27
  st.sidebar.title("Select a sample image")
28
 
29
  sample_name = st.sidebar.selectbox(
30
+ "Please choose an image",
31
  sample_fns
32
  )
33
 
 
45
 
46
  caption = predict(image)
47
  image.close()
48
+ caption_en = translator.translate(caption, src='fr', dest='en').text
49
+ st.header(f'**Prediction (in French) **{caption}')
50
+ st.header(f'**English Translation**: {caption_en}')
 
51
 
52
  st.sidebar.header("ViT-GPT2 predicts:")
53
+ st.sidebar.write(f"French: {caption}")
54
+ st.sidebar.write(f"English: {caption_en}")
55
+
56
+ show = st.sidebar.image(image, use_column_width=True)
57
+ show.image(image, use_column_width=True)