jaketae commited on
Commit
df702af
β€’
1 Parent(s): bf20f73

chore: add default url, update default caption

Browse files
Files changed (1) hide show
  1. image2text.py +7 -4
image2text.py CHANGED
@@ -21,12 +21,15 @@ def app(model_name):
21
  """
22
  )
23
 
24
- query1 = st.file_uploader("Choose an image...", type=["jpg", "jpeg", "png"])
25
- query2 = st.text_input("or a URL to an image...")
 
 
 
26
 
27
  captions = st.text_input(
28
  "Enter candidate captions in comma-separated form.",
29
- value="κ·€μ—¬μš΄ 고양이,λ©‹μžˆλŠ” 강아지,트랜슀포머",
30
  )
31
 
32
  if st.button("질문 (Query)"):
@@ -34,7 +37,7 @@ def app(model_name):
34
  st.error("Please upload an image or paste an image URL.")
35
  else:
36
  image_data = (
37
- query1 if query1 is not None else requests.get(query2, stream=True).raw
38
  )
39
  image = Image.open(image_data)
40
  st.image(image)
 
21
  """
22
  )
23
 
24
+ query1 = st.text_input(
25
+ "Enter a URL to an image...",
26
+ value="http://images.cocodataset.org/val2017/000000039769.jpg"
27
+ )
28
+ query2 = st.file_uploader("or upload an image...", type=["jpg", "jpeg", "png"])
29
 
30
  captions = st.text_input(
31
  "Enter candidate captions in comma-separated form.",
32
+ value="κ·€μ—¬μš΄ 고양이,λ©‹μžˆλŠ” 강아지,ν¬λ™ν¬λ™ν•œ ν–„μŠ€ν„°",
33
  )
34
 
35
  if st.button("질문 (Query)"):
 
37
  st.error("Please upload an image or paste an image URL.")
38
  else:
39
  image_data = (
40
+ query2 if query2 is not None else requests.get(query1, stream=True).raw
41
  )
42
  image = Image.open(image_data)
43
  st.image(image)