g8a9 commited on
Commit
13702fe
1 Parent(s): 9509c7f

Add sidebar

Browse files
Files changed (1) hide show
  1. app.py +9 -2
app.py CHANGED
@@ -12,6 +12,15 @@ tokenizer = AutoTokenizer.from_pretrained(CHECKPOINT)
12
 
13
  model.eval()
14
 
 
 
 
 
 
 
 
 
 
15
 
16
  def generate_caption(url):
17
  image = Image.open(requests.get(url, stream=True).raw).convert("RGB")
@@ -31,8 +40,6 @@ def generate_caption(url):
31
  return captions[0]
32
 
33
 
34
- st.title("Captioning demo")
35
-
36
  url = st.text_input(
37
  "Insert your URL", "https://iheartcats.com/wp-content/uploads/2015/08/c84.jpg"
38
  )
 
12
 
13
  model.eval()
14
 
15
+ st.title("Image Captioning with ViT & GePpeTto 🇮🇹")
16
+
17
+ st.sidebar.markdown("## Generation parameters")
18
+ max_length = st.sidebar.number_input("Max length", value=20, min_value=1)
19
+ num_beams = st.sidebar.number_input("Beam size", value=5, min_value=1)
20
+ early_stopping = st.sidebar.checkbox("Early stopping", value=True)
21
+ no_repeat_ngram_size= st.sidebar.number_input("no repeat ngrams size", value=2, min_value=1)
22
+ num_return_sequences = st.sidebar.number_input("Generated sequences", value=3, min_value=1)
23
+
24
 
25
  def generate_caption(url):
26
  image = Image.open(requests.get(url, stream=True).raw).convert("RGB")
 
40
  return captions[0]
41
 
42
 
 
 
43
  url = st.text_input(
44
  "Insert your URL", "https://iheartcats.com/wp-content/uploads/2015/08/c84.jpg"
45
  )