Spaces:
Build error
Build error
chore: add default url, update default caption
Browse files- image2text.py +7 -4
image2text.py
CHANGED
|
@@ -21,12 +21,15 @@ def app(model_name):
|
|
| 21 |
"""
|
| 22 |
)
|
| 23 |
|
| 24 |
-
query1 = st.
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
| 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 |
-
|
| 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)
|