Ceyda Cinarel commited on
Commit
92f215b
1 Parent(s): 3396f01
Files changed (2) hide show
  1. app.py +21 -22
  2. huggingface_explode3.png +0 -0
app.py CHANGED
@@ -10,9 +10,24 @@ import jax
10
 
11
  # st.header('Under construction')
12
 
13
- st.sidebar.write("")
14
- st.title("CLIP React Demo")
15
- st.write("Search Reaction GIFs with CLIP [Model Card](https://huggingface.co/flax-community/clip-reply)")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  st.write(" ")
17
  st.write(" ")
18
  @st.cache(allow_output_mutation=True)
@@ -36,14 +51,7 @@ image_index = load_image_index()
36
  model, processor = load_model()
37
 
38
  col_count=4
39
- top_k=st.sidebar.slider("Show top-K", min_value=1, max_value=50, value=20)
40
 
41
- show_val=st.sidebar.button("show all validation set images")
42
- if show_val:
43
- cols=st.sidebar.beta_columns(col_count)
44
- for i,im in enumerate(file_names):
45
- j=i%col_count
46
- cols[j].image("./imgs/"+im)
47
 
48
  # TODO
49
  def add_image_emb(image):
@@ -73,17 +81,8 @@ def query_with_images(query_images,query_text):
73
 
74
  q_cols=st.beta_columns([5,2,5])
75
 
76
- q_cols[0].markdown(
77
- """
78
- Example Queries :
79
-
80
- - I'm so scared right now
81
- - I got the job 🎉
82
- - OMG that is disgusting
83
- - I'm awesome
84
-
85
- """
86
- )
87
  q_cols[2].markdown(
88
  """
89
  Searches among the validation set images if not specified
@@ -93,7 +92,7 @@ q_cols[2].markdown(
93
  """
94
  )
95
 
96
- query_text = q_cols[0].text_input("Input text you want to get reaction for", value="I love you ❤️")
97
  query_images = q_cols[2].file_uploader("(optional) Upload images to rank them",type=['jpg','jpeg'], accept_multiple_files=True)
98
 
99
  if query_images:
 
10
 
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)
27
+ for i,im in enumerate(file_names):
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)
 
51
  model, processor = load_model()
52
 
53
  col_count=4
 
54
 
 
 
 
 
 
 
55
 
56
  # TODO
57
  def add_image_emb(image):
 
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","I'm awesome","I love you ❤️"]
85
+ example_input = q_cols[0].radio("Example Queries :",examples,index=4)
 
 
 
 
 
 
 
 
 
86
  q_cols[2].markdown(
87
  """
88
  Searches among the validation set images if not specified
 
92
  """
93
  )
94
 
95
+ query_text = q_cols[0].text_input("Write text you want to get reaction for", value=example_input)
96
  query_images = q_cols[2].file_uploader("(optional) Upload images to rank them",type=['jpg','jpeg'], accept_multiple_files=True)
97
 
98
  if query_images:
huggingface_explode3.png ADDED