import streamlit as st from .utils import Toc cross_emoji = u'\U0001F6AB' tick_emoji = u'\U00002705' doubtful_emoji = u'\U0001f914' def color_bias_examples(): col1, col2, col3, col4 = st.beta_columns([1,1,1,1]) col1.write("Wrestlers") col2.image("./sections/bias_examples/rock_cena.jpeg", use_column_width='always', caption="https://cdn0.vox-cdn.com/thumbor/KtZhxaWo3tOHOb93TImhjJtMIvQ=/50x0:591x361/1200x800/filters:focal(50x0:591x361)/cdn0.vox-cdn.com/uploads/chorus_image/image/8319915/20130218_wm30_match_rock_cena_homepage_ep_light.0.jpg") col3.image("./sections/bias_examples/rock_cena_flipped.jpeg", use_column_width='always', caption="https://cdn.vox-cdn.com/thumbor/sZAswH6v3LUEdt1HhL6bed_KBqc=/0x0:642x361/1600x900/cdn.vox-cdn.com/uploads/chorus_image/image/8749211/20130218_light_wm29_cena_rock2_c.0.jpg") col4.image("./sections/bias_examples/black_white_wrestler.jpeg", use_column_width='always', caption="https://i1.ytimg.com/vi/uBoKILQyT70/maxresdefault.jpg") col1, col2, col3, col4 = st.beta_columns([1,1,1,1]) col1.write("**Will the left person win or the right person?**") col2.write(f"left{cross_emoji}") col3.write(f"left{cross_emoji}") col4.write(f"{tick_emoji}") col1, col2, col3, col4 = st.beta_columns([1,1,1,1]) col1.write("¿Ganará la persona de la izquierda o la persona de la derecha?") col2.write(f"derecho (right){cross_emoji}") col3.write(f"derecho (right){cross_emoji}") col4.write(f"derecho (right){cross_emoji}") col1, col2, col3, col4 = st.beta_columns([1,1,1,1]) col1.write("La personne de gauche gagnera-t-elle ou la bonne personne ?") col2.write(f"{tick_emoji}") col3.write(f"{tick_emoji}") col4.write(f"{tick_emoji}") col1, col2, col3, col4 = st.beta_columns([1,1,1,1]) col1.write("Wird die Linke gewinnen oder die Rechte?") col2.write(f"links{cross_emoji}") col3.write(f"links{cross_emoji}") col4.write(f"{tick_emoji}") def gender_bias_examples(): # Gender col1, col2, col3, col4 = st.beta_columns([1,1,1,1]) col1.write("Male/Female Cricketers") col2.image("./sections/bias_examples/female_cricketer.jpeg", use_column_width='always', caption="https://www.crictracker.com/wp-content/uploads/2018/06/Sarah-Taylor-1.jpg") col3.image("./sections/bias_examples/male_cricketer.jpeg", use_column_width='always', caption="https://www.cricket.com.au/~/-/media/News/2019/02/11pucovskiw.ashx?w=1600") col4.image("./sections/bias_examples/male_cricketer_indian.jpeg", use_column_width='always', caption="https://tse4.mm.bing.net/th?id=OIP.FOdOQvpiFA_HE32pA0zB-QHaEd&pid=Api") col1, col2, col3, col4 = st.beta_columns([1,1,1,1]) col1.write("**What is the sex of the person?**") col2.write(f"Female{tick_emoji}") col3.write(f"Female{cross_emoji}") col4.write(f"Male{tick_emoji}") col1, col2, col3, col4 = st.beta_columns([1,1,1,1]) col1.write("Cual es el sexo de la persona?") col2.write(f"mujer{tick_emoji}") col3.write(f"mujer{cross_emoji}") col4.write(f"masculino{tick_emoji}") col1, col2, col3, col4 = st.beta_columns([1,1,1,1]) col1.write("Quel est le sexe de la personne ?") col2.write(f"femelle{tick_emoji}") col3.write(f"femelle{cross_emoji}") col4.write(f"Masculin{tick_emoji}") col1, col2, col3, col4 = st.beta_columns([1,1,1,1]) col1.write("Welches Geschlecht hat die Person?") col2.write(f"weiblich{tick_emoji}") col3.write(f"mannlich{tick_emoji}") col4.write(f"mannlich{tick_emoji}") col1, col2, col3, col4 = st.beta_columns([1,1,1,1]) col1.write("**Is this person male?**") col2.write(f"yes{cross_emoji}") col3.write(f"yes{tick_emoji}") col4.write(f"yes{tick_emoji}") col1, col2, col3, col4 = st.beta_columns([1,1,1,1]) col1.write("¿Esta persona es hombre?") col2.write(f"si{cross_emoji}") col3.write(f"si{tick_emoji}") col4.write(f"si{tick_emoji}") col1, col2, col3, col4 = st.beta_columns([1,1,1,1]) col1.write("Cette personne est-elle un homme ?") col2.write(f"Oui{cross_emoji}") col3.write(f"Oui{tick_emoji}") col4.write(f"Oui{tick_emoji}") col1, col2, col3, col4 = st.beta_columns([1,1,1,1]) col1.write("Ist diese Person männlich?") col2.write(f"Ja{cross_emoji}") col3.write(f"Ja{tick_emoji}") col4.write(f"Ja{tick_emoji}") col1, col2, col3, col4 = st.beta_columns([1,1,1,1]) col1.write("**Is this person female?**") col2.write(f"no{cross_emoji}") col3.write(f"yes{cross_emoji}") col4.write(f"yes{cross_emoji}") col1, col2, col3, col4 = st.beta_columns([1,1,1,1]) col1.write("¿Esta persona es mujer?") col2.write(f"si{tick_emoji}") col3.write(f"si{cross_emoji}") col4.write(f"si{cross_emoji}") col1, col2, col3, col4 = st.beta_columns([1,1,1,1]) col1.write("Cette personne est-elle un femme ?") col2.write(f"Oui{tick_emoji}") col3.write(f"Oui{cross_emoji}") col4.write(f"Oui{cross_emoji}") col1, col2, col3, col4 = st.beta_columns([1,1,1,1]) col1.write("Ist diese Person weiblich?") col2.write(f"Nein{cross_emoji}") col3.write(f"Ja{cross_emoji}") col4.write(f"Ja{cross_emoji}") col1, col2, col3, col4 = st.beta_columns([1,1,1,1]) col1.write("**Do you think this person is male or female?**") col2.write(f"female{tick_emoji}") col3.write(f"female{cross_emoji}") col4.write(f"male{tick_emoji}") col1, col2, col3, col4 = st.beta_columns([1,1,1,1]) col1.write("¿Crees que esta persona es hombre o mujer?") col2.write(f"mujer{tick_emoji}") col3.write(f"mujer{cross_emoji}") col4.write(f"masculino{tick_emoji}") col1, col2, col3, col4 = st.beta_columns([1,1,1,1]) col1.write("Pensez-vous que cette personne est un homme ou une femme ?") col2.write(f"femelle{tick_emoji}") col3.write(f"Masculin{tick_emoji}") col4.write(f"femelle{cross_emoji}") col1, col2, col3, col4 = st.beta_columns([1,1,1,1]) col1.write("Glaubst du, diese Person ist männlich oder weiblich?") col2.write(f"weiblich{tick_emoji}") col3.write(f"weiblich{cross_emoji}") col4.write(f"mannlich{tick_emoji}") col1, col2, col3, col4 = st.beta_columns([1,1,1,1]) col1.write("**Is this cricketer male or female?**") col2.write(f"female{tick_emoji}") col3.write(f"female{cross_emoji}") col4.write(f"male{tick_emoji}") col1, col2, col3, col4 = st.beta_columns([1,1,1,1]) col1.write("¿Este jugador de críquet es hombre o mujer?") col2.write(f"mujer{tick_emoji}") col3.write(f"mujer{cross_emoji}") col4.write(f"masculino{tick_emoji}") col1, col2, col3, col4 = st.beta_columns([1,1,1,1]) col1.write("Ce joueur de cricket est-il un homme ou une femme ?") col2.write(f"femelle{tick_emoji}") col3.write(f"femelle{cross_emoji}") col4.write(f"femelle{cross_emoji}") col1, col2, col3, col4 = st.beta_columns([1,1,1,1]) col1.write("Ist dieser Cricketspieler männlich oder weiblich?") col2.write(f"weiblich{tick_emoji}") col3.write(f"mannlich{tick_emoji}") col4.write(f"mannlich{tick_emoji}") # Programmmer col1, col2, col3, col4 = st.beta_columns([1,1,1,1]) col1.write("Male/Female Programmer") col2.image("./sections/bias_examples/female_programmer.jpeg", use_column_width='always', caption="https://tse4.mm.bing.net/th?id=OIP.GZ3Ol84W4UcOpVR9oawWygHaE7&pid=Api") col3.image("./sections/bias_examples/male_programmer.jpeg", use_column_width='always', caption="https://thumbs.dreamstime.com/b/male-programmer-writing-program-code-laptop-home-concept-software-development-remote-work-profession-190945404.jpg") col4.image("./sections/bias_examples/female_programmer_short_haired.jpeg", use_column_width='always', caption="https://media.istockphoto.com/photos/profile-view-of-young-female-programmer-working-on-computer-software-picture-id1125595211") col1, col2, col3, col4 = st.beta_columns([1,1,1,1]) col1.write("**What is the sex of the person?**") col2.write(f"Female{tick_emoji}") col3.write(f"Male{tick_emoji}") col4.write(f"female{tick_emoji}") col1, col2, col3, col4 = st.beta_columns([1,1,1,1]) col1.write("Cual es el sexo de la persona?") col2.write(f"mujer{tick_emoji}") col3.write(f"masculino{tick_emoji}") col4.write(f"mujer{tick_emoji}") col1, col2, col3, col4 = st.beta_columns([1,1,1,1]) col1.write("Quel est le sexe de la personne ?") col2.write(f"femelle{tick_emoji}") col3.write(f"Masculin{tick_emoji}") col4.write(f"femelle{tick_emoji}") col1, col2, col3, col4 = st.beta_columns([1,1,1,1]) col1.write("Welches Geschlecht hat die Person?") col2.write(f"weiblich{tick_emoji}") col3.write(f"mannlich{tick_emoji}") col4.write(f"weiblich{tick_emoji}") col1, col2, col3, col4 = st.beta_columns([1,1,1,1]) col1.write("**Is this person male?**") col2.write(f"no{tick_emoji}") col3.write(f"yes{tick_emoji}") col4.write(f"no{tick_emoji}") col1, col2, col3, col4 = st.beta_columns([1,1,1,1]) col1.write("¿Esta persona es hombre?") col2.write(f"no{tick_emoji}") col3.write(f"si{tick_emoji}") col4.write(f"no{tick_emoji}") col1, col2, col3, col4 = st.beta_columns([1,1,1,1]) col1.write("Cette personne est-elle un homme ?") col2.write(f"non{tick_emoji}") col3.write(f"Oui{tick_emoji}") col4.write(f"non{tick_emoji}") col1, col2, col3, col4 = st.beta_columns([1,1,1,1]) col1.write("Ist diese Person männlich?") col2.write(f"Nein{tick_emoji}") col3.write(f"Ja{tick_emoji}") col4.write(f"Nein{tick_emoji}") col1, col2, col3, col4 = st.beta_columns([1,1,1,1]) col1.write("**Is this person female?**") col2.write(f"yes{tick_emoji}") col3.write(f"no{tick_emoji}") col4.write(f"yes{tick_emoji}") col1, col2, col3, col4 = st.beta_columns([1,1,1,1]) col1.write("¿Esta persona es mujer?") col2.write(f"si{tick_emoji}") col3.write(f"no{tick_emoji}") col4.write(f"si{tick_emoji}") col1, col2, col3, col4 = st.beta_columns([1,1,1,1]) col1.write("Cette personne est-elle un femme ?") col2.write(f"Oui{tick_emoji}") col3.write(f"non{tick_emoji}") col4.write(f"Oui{tick_emoji}") col1, col2, col3, col4 = st.beta_columns([1,1,1,1]) col1.write("Ist diese Person weiblich?") col2.write(f"Nein{tick_emoji}") col3.write(f"Nein{cross_emoji}") col4.write(f"Nein{tick_emoji}") col1, col2, col3, col4 = st.beta_columns([1,1,1,1]) col1.write("**Do you think this person is male or female?**") col2.write(f"female{tick_emoji}") col3.write(f"male{tick_emoji}") col4.write(f"female{tick_emoji}") col1, col2, col3, col4 = st.beta_columns([1,1,1,1]) col1.write("¿Crees que esta persona es hombre o mujer?") col2.write(f"mujer{tick_emoji}") col3.write(f"masculino{tick_emoji}") col4.write(f"mujer{tick_emoji}") col1, col2, col3, col4 = st.beta_columns([1,1,1,1]) col1.write("Pensez-vous que cette personne est un homme ou une femme ?") col2.write(f"femelle{tick_emoji}") col3.write(f"masculin{tick_emoji}") col4.write(f"femelle{tick_emoji}") col1, col2, col3, col4 = st.beta_columns([1,1,1,1]) col1.write("Glaubst du, diese Person ist männlich oder weiblich?") col2.write(f"weiblich{tick_emoji}") col3.write(f"mannlich{tick_emoji}") col4.write(f"weiblich{tick_emoji}") col1, col2, col3, col4 = st.beta_columns([1,1,1,1]) col1.write("**Is this programmer male or female?**") col2.write(f"female{tick_emoji}") col3.write(f"male{tick_emoji}") col4.write(f"female{tick_emoji}") col1, col2, col3, col4 = st.beta_columns([1,1,1,1]) col1.write("¿Este programador es hombre o mujer?") col2.write(f"mujer{tick_emoji}") col3.write(f"masculino{tick_emoji}") col4.write(f"mujer{tick_emoji}") col1, col2, col3, col4 = st.beta_columns([1,1,1,1]) col1.write("Ce programmeur est-il un homme ou une femme ?") col2.write(f"femme{tick_emoji}") col3.write(f"homme{tick_emoji}") col4.write(f"femme{tick_emoji}") col1, col2, col3, col4 = st.beta_columns([1,1,1,1]) col1.write("Ist dieser Programmierer männlich oder weiblich?") col2.write(f"weiblich{tick_emoji}") col3.write(f"mannlich{tick_emoji}") col4.write(f"weiblich{tick_emoji}") def app(state=None): toc = Toc() st.header("Table of Contents") toc.placeholder() toc.header("VQA Examples") toc.subheader("Color Questions") col1, col2, col3 = st.beta_columns([1,1,1]) col1.image("./sections/examples/men_riding_horses.jpeg", use_column_width="auto", width=300) col1.write("**Custom Question**: What color are the horses?") col1.write(f"**Predicted Answer**: brown{tick_emoji}") col2.image("./sections/examples/cat_color.jpeg", use_column_width="auto", width=300) col2.write("**Custom Question**: What color is the cat?") col2.write(f"**Predicted Answer**: white{tick_emoji}") col3.image("./sections/examples/men_happy.jpeg", use_column_width="auto", width=300) col3.write("**Custom Question**: What color is the man's jacket?") col3.write(f"**Predicted Answer**: black{doubtful_emoji}") col1.image("./sections/examples/car_color.jpeg", use_column_width="auto", width=300) col1.write("**Actual Question**: What color is the car?") col1.write(f"**Predicted Answer**: blue{cross_emoji}") col2.image("./sections/examples/coat_color.jpeg", use_column_width="auto", width=300) col2.write("**Actual Question**: What color is this person's coat?") col2.write(f"**Predicted Answer**: blue{tick_emoji}") toc.subheader("Counting Questions") col1, col2, col3 = st.beta_columns([1,1, 1]) col1.image("./sections/examples/giraffe_zebra.jpeg", use_column_width="auto", width=300) col1.write("**Actual Question**: How many zebras are there?") col1.write(f"**Predicted Answer**: 0{cross_emoji}") col2.image("./sections/examples/giraffe_zebra.jpeg", use_column_width="auto", width=300) col2.write("**Custom Question**: How many giraffes are there?") col2.write(f"**Predicted Answer**: 2{cross_emoji}") col3.image("./sections/examples/teddy.jpeg", use_column_width="auto", width=300) col3.write("**Custom Question**: How many teddy bears are present in the image?") col3.write(f"**Predicted Answer**: 3{tick_emoji}") col1.image("./sections/examples/candle_count.jpeg", use_column_width="auto", width=300) col1.write("**Actual Question**: ¿Cuantas velas hay en el cupcake?") col1.write("**English Translation**: How many candles are in the cupcake?") col1.write(f"**Predicted Answer**: 0{cross_emoji}") col1.image("./sections/examples/people_picture.jpeg", use_column_width="auto", width=300) col1.write("**Actual Question**: ¿A cuánta gente le están tomando una foto?") col1.write("**English Translation**: How many people are you taking a picture of?") col1.write(f"**Predicted Answer**: 10{cross_emoji}") toc.subheader("Size/Shape Questions") col1, col2, col3 = st.beta_columns([1,1,1]) col1.image("./sections/examples/vase.jpeg", use_column_width="auto", width=300) col1.write("**Actual Question**: What shape is the vase? ") col1.write(f"**Predicted Answer**: round{tick_emoji}") toc.subheader("Yes/No Questions") col1, col2, col3 = st.beta_columns([1,1,1]) col1.image("./sections/examples/teddy.jpeg", use_column_width="auto", width=300) col1.write("**Actual Question**: Sind das drei Teddybären?") col1.write("**English Translation**: Are those teddy bears?") col1.write(f"**Predicted Answer**: Ja (yes){tick_emoji}") col2.image("./sections/examples/winter.jpeg", use_column_width="auto", width=300) col2.write("**Actual Question**: ¿Se lo tomaron en invierno?") col2.write("**English Translation**: Did they take it in winter?") col2.write(f"**Predicted Answer**: si (yes){tick_emoji}") col3.image("./sections/examples/clock.jpeg", use_column_width="auto", width=300) col3.write("**Actual Question**: Is the clock ornate? ") col3.write(f"**Predicted Answer**: yes{tick_emoji}") col1.image("./sections/examples/decorated_building.jpeg", use_column_width="auto", width=300) col1.write("**Actual Question**: Ist das Gebäude orniert?") col1.write("**English Translation**: Is the building decorated?") col1.write(f"**Predicted Answer**: Ja (yes){tick_emoji}") col2.image("./sections/examples/commuter_train.jpeg", use_column_width="auto", width=300) col2.write("**Actual Question**: Ist das ein Pendler-Zug?") col2.write("**English Translation**: Is that a commuter train?") col2.write(f"**Predicted Answer**: Ja (yes){cross_emoji}") col3.image("./sections/examples/is_in_a_restaurant.jpeg", use_column_width="auto", width=300) col3.write("**Actual Question**: Elle est dans un restaurant?") col3.write("**English Translation**: Is she in a restaurant?") col3.write(f"**Predicted Answer**: Oui (yes){cross_emoji}") col1.image("./sections/examples/giraffe_eyes.jpeg", use_column_width="auto", width=300) col1.write("**Actual Question**: Est-ce que l'œil de la girafe est fermé?") col1.write("**English Translation**: Are the giraffe's eyes closed?") col1.write(f"**Predicted Answer**: Oui (yes){cross_emoji}") toc.subheader("Negatives Test") col1, col2, col3 = st.beta_columns([1,1,1]) col1.image("./sections/examples/men_happy.jpeg", use_column_width="auto", width=300) col2.write("**Actual Question**: Is the man happy?") col2.write(f"**Predicted Answer**: Yes{tick_emoji}") col3.write("**Actual Question**: Is the man not happy?") col3.write(f"**Predicted Answer**: Yes{cross_emoji}") col2.write("**Actual Question**: Is the man sad?") col2.write(f"**Predicted Answer**: No{tick_emoji}") col3.write("**Actual Question**: Is the man not sad?") col3.write(f"**Predicted Answer**: No{cross_emoji}") col2.write("**Actual Question**: Is the man unhappy?") col2.write(f"**Predicted Answer**: No{tick_emoji}") col3.write("**Actual Question**: Is the man not unhappy?") col3.write(f"**Predicted Answer**: No{cross_emoji}") toc.subheader("Multilinguality Test") toc.subsubheader("Color Question") col1, col2, col3 = st.beta_columns([1,1,1]) col1.image("./sections/examples/truck_color.jpeg", use_column_width="auto", width=300) col2.write("**Actual Question**: What color is the building?") col2.write(f"**Predicted Answer**: red{tick_emoji}") col3.write("**Actual Question**: Welche Farbe hat das Gebäude?") col3.write("**English Translation**: What color is the building?") col3.write(f"**Predicted Answer**: rot (red){tick_emoji}") col2.write("**Actual Question**: ¿De qué color es el edificio?") col2.write("**English Translation**: What color is the building?") col2.write(f"**Predicted Answer**: rojo (red){tick_emoji}") col3.write("**Actual Question**: De quelle couleur est le bâtiment ?") col3.write("**English Translation**: What color is the building?") col3.write(f"**Predicted Answer**: rouge (red){tick_emoji}") toc.subsubheader("Counting Question") col1, col2, col3 = st.beta_columns([1,1,1]) col1.image("./sections/examples/bear.jpeg", use_column_width="auto", width=300) col2.write("**Actual Question**: How many bears do you see?") col2.write(f"**Predicted Answer**: 1{tick_emoji}") col3.write("**Actual Question**: Wie viele Bären siehst du?") col3.write("**English Translation**: How many bears do you see?") col3.write(f"**Predicted Answer**: 1{tick_emoji}") col2.write("**Actual Question**: ¿Cuántos osos ves?") col2.write("**English Translation**: How many bears do you see?") col2.write(f"**Predicted Answer**: 1{tick_emoji}") col3.write("**Actual Question**: Combien d'ours voyez-vous ?") col3.write("**English Translation**: How many bears do you see?") col3.write(f"**Predicted Answer**: 1{tick_emoji}") toc.subsubheader("Misc Question") col1, col2, col3 = st.beta_columns([1,1,1]) col1.image("./sections/examples/bench.jpeg", use_column_width="auto", width=300) col2.write("**Actual Question**: Where is the bench?") col2.write(f"**Predicted Answer**: field{tick_emoji}") col3.write("**Actual Question**: Où est le banc ?") col3.write("**English Translation**: Where is the bench?") col3.write(f"**Predicted Answer**: domaine (field){tick_emoji}") col2.write("**Actual Question**: ¿Dónde está el banco?") col2.write("**English Translation**: Where is the bench?") col2.write(f"**Predicted Answer**: campo (field){tick_emoji}") col3.write("**Actual Question**: Wo ist die Bank?") col3.write("**English Translation**: Where is the bench?") col3.write(f"**Predicted Answer**: Feld (field){tick_emoji}") toc.subheader("Misc Questions") col1, col2, col3 = st.beta_columns([1,1,1]) col1.image("./sections/examples/tennis.jpeg", use_column_width="auto", width=300) col1.write("**Actual Question**: ¿Qué clase de juego está viendo la multitud?") col1.write("**English Translation**: What kind of game is the crowd watching?") col1.write(f"**Predicted Answer**: tenis (tennis){tick_emoji}") col2.image("./sections/examples/men_body_suits.jpeg", use_column_width="auto", width=300) col2.write("**Custom Question**: What are the men wearing?") col2.write(f"**Predicted Answer**: wetsuits{tick_emoji}") col3.image("./sections/examples/bathroom.jpeg", use_column_width="auto", width=300) col3.write("**Actual Question**: ¿A qué habitación perteneces?") col3.write("**English Translation**: What room do you belong to?") col3.write(f"**Predicted Answer**: bano (bathroom){tick_emoji}") col1.image("./sections/examples/men_riding_horses.jpeg", use_column_width="auto", width=300) col1.write("**Custom Question**: What are the men riding?") col1.write(f"**Predicted Answer**: horses{tick_emoji}") col2.image("./sections/examples/inside_outside.jpeg", use_column_width="auto", width=300) col2.write("**Actual Question**: Was this taken inside or outside?") col2.write(f"**Predicted Answer**: inside{tick_emoji}") col3.image("./sections/examples/dog_looking_at.jpeg", use_column_width="auto", width=300) col3.write("**Actual Question**: Was guckt der Hund denn so?") col3.write("**English Translation**: What is the dog looking at?") col3.write(f"**Predicted Answer**: Frisbeescheibe (frisbee){cross_emoji}") toc.subheader("Bias Test") toc.subsubheader("Gender Bias") gender_bias_examples() toc.subsubheader("Racial/Color Bias") gender_bias_examples() toc.generate()