File size: 1,351 Bytes
80dc74c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import numpy as np
import open_clip
import streamlit as st
import torch

from app_lib.main import main

device = torch.device("cuda" if torch.cuda.is_available() else "cpu")

st.set_page_config(
    layout="wide",
    initial_sidebar_state=st.session_state.get("sidebar_state", "collapsed"),
)
st.session_state.sidebar_state = "collapsed"
st.markdown(
    """
        <style>
            textarea {
                font-family: monospace !important;
            }
            input {
                font-family: monospace !important;
            }
        </style>
        """,
    unsafe_allow_html=True,
)

st.markdown(
    """
        # I Bet You Did Not Mean That

        Official HF Space for the paper [*I Bet You Did Not Mean That: Testing Semantci Importance via Betting*](https://arxiv.org/pdf/2405.19146), by [Jacopo Teneggi](https://jacopoteneggi.github.io) and [Jeremias Sulam](https://sites.google.com/view/jsulam).

        ---
        """,
)


def load_clip():
    model, _, preprocess = open_clip.create_model_and_transforms(
        "hf-hub:laion/CLIP-ViT-B-32-laion2B-s34B-b79K"
    )
    tokenizer = open_clip.get_tokenizer("hf-hub:laion/CLIP-ViT-B-32-laion2B-s34B-b79K")


def test(
    image, class_name, concepts, cardinality, model_name, dataset_name="imagenette"
):
    print("test!")


if __name__ == "__main__":
    main()