Spaces:
Runtime error
Runtime error
File size: 1,099 Bytes
06bba7e ff2e0a9 06bba7e ff2e0a9 06bba7e 53625b9 ff2e0a9 53625b9 06bba7e ff2e0a9 53625b9 ff2e0a9 53625b9 06bba7e e08783a ff2e0a9 e08783a ff2e0a9 e08783a 06bba7e |
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 |
import streamlit as st
from huggingface_hub import HfFolder, snapshot_download
HfFolder().save_token(st.secrets['etoken'])
snapshot_download("OpenShape/openshape-demo-support", local_dir='.')
import numpy
import openshape
from openshape.demo import misc_utils, classification
@st.cache_resource
def load_openshape(name):
return openshape.load_pc_encoder(name)
f32 = numpy.float32
# clip_model, clip_prep = load_openclip()
model_g14 = openshape.load_pc_encoder('openshape-pointbert-vitg14-rgb')
st.title("OpenShape Demo")
load_data = misc_utils.input_3d_shape()
prog = st.progress(0.0, "Idle")
try:
if st.button("Run Classification on LVIS Categories"):
pc = load_data(prog)
col2 = misc_utils.render_pc(pc)
prog.progress(0.5, "Running Classification")
pred = classification.pred_lvis_sims(model_g14, pc)
with col2:
for i, (cat, sim) in zip(range(5), pred.items()):
st.text(cat)
st.caption("Similarity %.4f" % sim)
prog.progress(1.0, "Idle")
except Exception as exc:
st.error(repr(exc))
|