IBYDMT / app.py
jacopoteneggi's picture
Update
80dc74c verified
raw
history blame
1.35 kB
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()