g8a9 commited on
Commit
da172d6
1 Parent(s): 6101644

Add Examples & Applications

Browse files
app.py CHANGED
@@ -2,14 +2,20 @@ import streamlit as st
2
  import image2text
3
  import text2image
4
  import home
 
5
  from PIL import Image
6
 
7
- PAGES = {"Introduction": home, "Text to Image": text2image, "Image to Text": image2text}
 
 
 
 
 
8
 
9
  st.sidebar.title("Explore our CLIP-Italian demo")
10
 
11
- logo = Image.open('static/img/clip_italian_logo.png')
12
- st.sidebar.image(logo, caption='CLIP-Italian logo')
13
 
14
  page = st.sidebar.radio("", list(PAGES.keys()))
15
  PAGES[page].app()
 
2
  import image2text
3
  import text2image
4
  import home
5
+ import examples
6
  from PIL import Image
7
 
8
+ PAGES = {
9
+ "Introduction": home,
10
+ "Text to Image": text2image,
11
+ "Image to Text": image2text,
12
+ "Examples & Applications": examples,
13
+ }
14
 
15
  st.sidebar.title("Explore our CLIP-Italian demo")
16
 
17
+ logo = Image.open("static/img/clip_italian_logo.png")
18
+ st.sidebar.image(logo, caption="CLIP-Italian logo")
19
 
20
  page = st.sidebar.radio("", list(PAGES.keys()))
21
  PAGES[page].app()
examples.py ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from home import read_markdown_file
2
+ import streamlit as st
3
+
4
+
5
+ def app():
6
+ st.title("Examples & Applications")
7
+ st.write(
8
+ """
9
+
10
+ ## Image Retrieval
11
+
12
+ Even though we trained the Italian CLIP model on way less examples than the original
13
+ OpenAI's CLIP, our training choices and quality datasets led to impressive results!
14
+ Here, we collected few of **the most impressive text-image associations** learned by our model.
15
+
16
+ Remember you can head any time to the **Text to Image** section of the demo to test
17
+ your own 🤌 Italian 🤌 queries!
18
+
19
+ """
20
+ )
21
+
22
+ st.markdown("### 1. Actors in Scenes")
23
+
24
+ col1, col2 = st.beta_columns(2)
25
+ col1.subheader("una coppia con il tramonto sullo sfondo")
26
+ col1.markdown("*a couple with the sunset in the background*")
27
+ col1.image("static/img/examples/couple_1.jpeg")
28
+
29
+ col2.subheader("una coppia che passeggia sulla spiaggia")
30
+ col2.markdown("*a couple walking on the beach*")
31
+ col2.image("static/img/examples/couple_2.jpeg")
32
+
33
+ st.subheader("una coppia che passeggia sulla spiaggia al tramonto")
34
+ st.markdown("*a couple walking on the beach at sunset*")
35
+ st.image("static/img/examples/couple_3.jpeg")
static/img/examples/couple_1.jpeg ADDED
static/img/examples/couple_2.jpeg ADDED
static/img/examples/couple_3.jpeg ADDED