Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -216,6 +216,17 @@ def retrieval_text(text, k, sim_th, filter_fn):
|
|
216 |
|
217 |
prog.progress(1.0, "Idle")
|
218 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
219 |
try:
|
220 |
f32 = numpy.float32
|
221 |
half = torch.float16 if torch.cuda.is_available() else torch.bfloat16
|
@@ -279,12 +290,16 @@ try:
|
|
279 |
'Choose the mode of generation',
|
280 |
("PointCloud-to-Image", "PointCloud-to-Text")
|
281 |
)
|
282 |
-
|
283 |
if generation_mode == "PointCloud-to-Image":
|
284 |
st.title("Image Generation")
|
285 |
prog = st.progress(0.0, "Idle")
|
|
|
|
|
|
|
|
|
286 |
if st.sidebar.button("submit"):
|
287 |
-
|
288 |
elif generation_mode == "PointCloud-to-Text":
|
289 |
st.title("Text Generation")
|
290 |
prog = st.progress(0.0, "Idle")
|
|
|
216 |
|
217 |
prog.progress(1.0, "Idle")
|
218 |
|
219 |
+
def generation_img(load_data, prompt, noise_scale, cfg_scale, steps):
|
220 |
+
pc = load_data(prog)
|
221 |
+
prog.progress(0.49, "Running Generation")
|
222 |
+
col2 = utils.render_pc(pc)
|
223 |
+
if torch.cuda.is_available():
|
224 |
+
with sys.clip_move_lock:
|
225 |
+
clip_model.cpu()
|
226 |
+
|
227 |
+
width = 640
|
228 |
+
height = 640
|
229 |
+
|
230 |
try:
|
231 |
f32 = numpy.float32
|
232 |
half = torch.float16 if torch.cuda.is_available() else torch.bfloat16
|
|
|
290 |
'Choose the mode of generation',
|
291 |
("PointCloud-to-Image", "PointCloud-to-Text")
|
292 |
)
|
293 |
+
load_data = utils.input_3d_shape('rpcinput')
|
294 |
if generation_mode == "PointCloud-to-Image":
|
295 |
st.title("Image Generation")
|
296 |
prog = st.progress(0.0, "Idle")
|
297 |
+
prompt = st.sidebar.text_input("Prompt (Optional)", key='sdtprompt')
|
298 |
+
noise_scale = st.sidebar.slider('Variation Level', 0, 5, 1)
|
299 |
+
cfg_scale = st.sidebar.slider('Guidance Scale', 0.0, 30.0, 10.0)
|
300 |
+
steps = st.sidebar.slider('Diffusion Steps', 8, 50, 25)
|
301 |
if st.sidebar.button("submit"):
|
302 |
+
generation_img(load_data, prompt, noise_scale, cfg_scale, steps)
|
303 |
elif generation_mode == "PointCloud-to-Text":
|
304 |
st.title("Text Generation")
|
305 |
prog = st.progress(0.0, "Idle")
|