Spaces:
Build error
Build error
Sasikanth
commited on
Commit
·
bd597e9
1
Parent(s):
b5cab38
updated to render multiple objects
Browse files
app.py
CHANGED
@@ -11,6 +11,22 @@ from demo.src.config import MODEL_DIR, MODEL_NAME, FILE_ID
|
|
11 |
|
12 |
st.set_page_config(page_title="DietNeRF Demo")
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
@st.cache
|
16 |
def download_model():
|
@@ -34,6 +50,7 @@ model_path = os.path.join(MODEL_DIR, MODEL_NAME)
|
|
34 |
if not os.path.isfile(model_path):
|
35 |
download_model()
|
36 |
|
|
|
37 |
model, state = fetch_model()
|
38 |
pi = math.pi
|
39 |
st.sidebar.image("images/diet-nerf.png", width=310)
|
@@ -55,4 +72,4 @@ with st.spinner("Rendering Image (may take 2-3 mins)..."):
|
|
55 |
pred_color, _ = render_predict_from_pose(state, theta, phi, radius)
|
56 |
im = predict_to_image(pred_color)
|
57 |
|
58 |
-
st.image(im, use_column_width=
|
|
|
11 |
|
12 |
st.set_page_config(page_title="DietNeRF Demo")
|
13 |
|
14 |
+
def select_model():
|
15 |
+
obj_select = st.selectbox("Select Object to Render", ('Chair', 'Lego','Ship'))
|
16 |
+
if obj_select == 'Chair':
|
17 |
+
FILE_ID = "17dj0pQieo94TozFv-noSBkXebduij1aM"
|
18 |
+
MODEL_DIR = 'models'
|
19 |
+
MODEL_NAME = 'diet_nerf_chair'
|
20 |
+
elif obj_select == 'Lego':
|
21 |
+
FILE_ID = "1D9I-qIVMPaxuCHfUWPWMHaoLYtAmCjwI"
|
22 |
+
MODEL_DIR = 'models'
|
23 |
+
MODEL_NAME = 'diet_nerf_lego'
|
24 |
+
elif obj_select == 'Ship':
|
25 |
+
FILE_ID = "14ZeJ86ETQr8dtu6CFoxU-ifvniHKo_Dt"
|
26 |
+
MODEL_DIR = 'models'
|
27 |
+
MODEL_NAME = 'diet_nerf_ship'
|
28 |
+
return MODEL_DIR,MODEL_NAME,FILE_ID
|
29 |
+
|
30 |
|
31 |
@st.cache
|
32 |
def download_model():
|
|
|
50 |
if not os.path.isfile(model_path):
|
51 |
download_model()
|
52 |
|
53 |
+
MODEL_DIR,MODEL_NAME,FILE_ID = select_model()
|
54 |
model, state = fetch_model()
|
55 |
pi = math.pi
|
56 |
st.sidebar.image("images/diet-nerf.png", width=310)
|
|
|
72 |
pred_color, _ = render_predict_from_pose(state, theta, phi, radius)
|
73 |
im = predict_to_image(pred_color)
|
74 |
|
75 |
+
st.image(im, use_column_width=True)
|