khaledeng15 commited on
Commit
a827854
·
1 Parent(s): a8370b6
Files changed (1) hide show
  1. pages/blip-image-captioning.py +5 -3
pages/blip-image-captioning.py CHANGED
@@ -7,14 +7,16 @@ from transformers import pipeline
7
  pipe = pipeline("image-to-text",
8
  model="Salesforce/blip-image-captioning-base")
9
 
10
-
 
 
11
  def launch(input):
12
  out = pipe(input)
13
  return out[0]['generated_text']
14
 
15
- uploaded_file = st.file_uploader("Choose a file")
 
16
 
17
- st.write(launch(uploaded_file))
18
 
19
  # iface = gr.Interface(launch,
20
  # inputs=gr.Image(type='pil'),
 
7
  pipe = pipeline("image-to-text",
8
  model="Salesforce/blip-image-captioning-base")
9
 
10
+ def process_file():
11
+ st.write(launch(uploaded_file))
12
+
13
  def launch(input):
14
  out = pipe(input)
15
  return out[0]['generated_text']
16
 
17
+ uploaded_file = st.file_uploader("Choose a file", on_change=process_file)
18
+
19
 
 
20
 
21
  # iface = gr.Interface(launch,
22
  # inputs=gr.Image(type='pil'),