Spaces:
Build error
Build error
style: run linter
Browse files- app.py +6 -2
- image2text.py +4 -4
app.py
CHANGED
|
@@ -1,10 +1,14 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
|
| 3 |
import image2text
|
| 4 |
-
import text2image
|
| 5 |
import most_relevant_part
|
|
|
|
| 6 |
|
| 7 |
-
PAGES = {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
st.sidebar.title("Navigation")
|
| 10 |
model = st.sidebar.selectbox("Choose a model", ["koclip-base", "koclip-large"])
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
|
| 3 |
import image2text
|
|
|
|
| 4 |
import most_relevant_part
|
| 5 |
+
import text2image
|
| 6 |
|
| 7 |
+
PAGES = {
|
| 8 |
+
"Text to Image": text2image,
|
| 9 |
+
"Image to Text": image2text,
|
| 10 |
+
"Most Relevant Part of Image": most_relevant_part,
|
| 11 |
+
}
|
| 12 |
|
| 13 |
st.sidebar.title("Navigation")
|
| 14 |
model = st.sidebar.selectbox("Choose a model", ["koclip-base", "koclip-large"])
|
image2text.py
CHANGED
|
@@ -22,8 +22,8 @@ def app(model_name):
|
|
| 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 |
|
|
@@ -41,8 +41,8 @@ def app(model_name):
|
|
| 41 |
)
|
| 42 |
image = Image.open(image_data)
|
| 43 |
st.image(image)
|
| 44 |
-
#captions = [caption.strip() for caption in captions.split(",")]
|
| 45 |
-
captions = [f
|
| 46 |
inputs = processor(
|
| 47 |
text=captions, images=image, return_tensors="jax", padding=True
|
| 48 |
)
|
|
|
|
| 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 |
|
|
|
|
| 41 |
)
|
| 42 |
image = Image.open(image_data)
|
| 43 |
st.image(image)
|
| 44 |
+
# captions = [caption.strip() for caption in captions.split(",")]
|
| 45 |
+
captions = [f"์ด๊ฒ์ {caption.strip()}์ด๋ค." for caption in captions.split(",")]
|
| 46 |
inputs = processor(
|
| 47 |
text=captions, images=image, return_tensors="jax", padding=True
|
| 48 |
)
|