import numpy as np import streamlit as st from transformers import CLIPProcessor, FlaxCLIPModel def get_image(text): model = FlaxCLIPModel.from_pretrained("flax-community/clip-rsicd-v2") processor = CLIPProcessor.from_pretrained("openai/clip-vit-base-patch32") inputs = processor(text=[text], image=None, return_tensors="jax", padding=True) vector = model.get_text_features(**inputs) vector = np.asarray(vector) def app(): st.title("Welcome to Space Vector") st.text("You want search an image with given text.") text = st.text_input("Enter text: ") if st.button("Search"): st.image(get_image(text))