Spaces:
Runtime error
Runtime error
Ceyda Cinarel
commited on
Commit
·
07c95a1
1
Parent(s):
92f215b
update
Browse files
app.py
CHANGED
|
@@ -11,16 +11,29 @@ import jax
|
|
| 11 |
# st.header('Under construction')
|
| 12 |
|
| 13 |
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
st.sidebar.title("CLIP React Demo")
|
| 18 |
-
st.sidebar.write("Search Reaction GIFs with CLIP [Model Card](https://huggingface.co/flax-community/clip-reply)")
|
| 19 |
-
st.sidebar.image("./huggingface_explode3.png",width=150)
|
| 20 |
-
|
| 21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
top_k=st.sidebar.slider("Show top-K", min_value=1, max_value=50, value=20)
|
| 23 |
-
|
| 24 |
show_val=st.sidebar.button("show all validation set images")
|
| 25 |
if show_val:
|
| 26 |
cols=st.sidebar.beta_columns(col_count)
|
|
@@ -28,6 +41,7 @@ if show_val:
|
|
| 28 |
j=i%col_count
|
| 29 |
cols[j].image("./imgs/"+im)
|
| 30 |
|
|
|
|
| 31 |
st.write(" ")
|
| 32 |
st.write(" ")
|
| 33 |
@st.cache(allow_output_mutation=True)
|
|
@@ -50,7 +64,7 @@ file_names.sort()
|
|
| 50 |
image_index = load_image_index()
|
| 51 |
model, processor = load_model()
|
| 52 |
|
| 53 |
-
|
| 54 |
|
| 55 |
|
| 56 |
# TODO
|
|
@@ -81,7 +95,7 @@ def query_with_images(query_images,query_text):
|
|
| 81 |
|
| 82 |
q_cols=st.beta_columns([5,2,5])
|
| 83 |
|
| 84 |
-
examples = ["I'm so scared right now"," I got the job 🎉","OMG that is disgusting","
|
| 85 |
example_input = q_cols[0].radio("Example Queries :",examples,index=4)
|
| 86 |
q_cols[2].markdown(
|
| 87 |
"""
|
|
|
|
| 11 |
# st.header('Under construction')
|
| 12 |
|
| 13 |
|
|
|
|
|
|
|
|
|
|
| 14 |
st.sidebar.title("CLIP React Demo")
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
+
st.sidebar.write("[Model Card](https://huggingface.co/flax-community/clip-reply)")
|
| 17 |
+
sc= st.sidebar.beta_columns(2)
|
| 18 |
+
|
| 19 |
+
sc[0].image("./huggingface_explode3.png",width=150)
|
| 20 |
+
sc[1].write(" ")
|
| 21 |
+
sc[1].write(" ")
|
| 22 |
+
sc[1].markdown("## Researching fun")
|
| 23 |
+
|
| 24 |
+
with st.sidebar.beta_expander("Motivation",expanded=True):
|
| 25 |
+
st.markdown(
|
| 26 |
+
"""
|
| 27 |
+
Reaction GIFs became an integral part of communication.
|
| 28 |
+
They convey complex emotions with many levels, in a short compact format.
|
| 29 |
+
|
| 30 |
+
If a picture is worth a thousand words then a GIF is worth more.
|
| 31 |
+
A lot of people would agree it is not always easy to find the perfect reaction GIF.
|
| 32 |
+
This is just a first step in the more ambitious goal of GIF/Image generation.
|
| 33 |
+
"""
|
| 34 |
+
)
|
| 35 |
top_k=st.sidebar.slider("Show top-K", min_value=1, max_value=50, value=20)
|
| 36 |
+
col_count=4
|
| 37 |
show_val=st.sidebar.button("show all validation set images")
|
| 38 |
if show_val:
|
| 39 |
cols=st.sidebar.beta_columns(col_count)
|
|
|
|
| 41 |
j=i%col_count
|
| 42 |
cols[j].image("./imgs/"+im)
|
| 43 |
|
| 44 |
+
st.write("# Search Reaction GIFs with CLIP")
|
| 45 |
st.write(" ")
|
| 46 |
st.write(" ")
|
| 47 |
@st.cache(allow_output_mutation=True)
|
|
|
|
| 64 |
image_index = load_image_index()
|
| 65 |
model, processor = load_model()
|
| 66 |
|
| 67 |
+
|
| 68 |
|
| 69 |
|
| 70 |
# TODO
|
|
|
|
| 95 |
|
| 96 |
q_cols=st.beta_columns([5,2,5])
|
| 97 |
|
| 98 |
+
examples = ["I'm so scared right now"," I got the job 🎉","OMG that is disgusting","You're awesome","I love you ❤️"]
|
| 99 |
example_input = q_cols[0].radio("Example Queries :",examples,index=4)
|
| 100 |
q_cols[2].markdown(
|
| 101 |
"""
|