3v324v23 commited on
Commit
cda7b4b
1 Parent(s): 0c12190
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitignore +2 -0
  2. app.py +19 -17
  3. models/__pycache__/__init__.cpython-37.pyc +0 -0
  4. models/__pycache__/__init__.cpython-39.pyc +0 -0
  5. models/__pycache__/bev3d_generator.cpython-37.pyc +0 -0
  6. models/__pycache__/bev3d_generator.cpython-39.pyc +0 -0
  7. models/__pycache__/eg3d_discriminator.cpython-37.pyc +0 -0
  8. models/__pycache__/eg3d_discriminator.cpython-39.pyc +0 -0
  9. models/__pycache__/eg3d_generator.cpython-37.pyc +0 -0
  10. models/__pycache__/eg3d_generator.cpython-39.pyc +0 -0
  11. models/__pycache__/eg3d_generator_fv.cpython-37.pyc +0 -0
  12. models/__pycache__/eg3d_generator_fv.cpython-39.pyc +0 -0
  13. models/__pycache__/ghfeat_encoder.cpython-37.pyc +0 -0
  14. models/__pycache__/ghfeat_encoder.cpython-39.pyc +0 -0
  15. models/__pycache__/inception_model.cpython-37.pyc +0 -0
  16. models/__pycache__/inception_model.cpython-39.pyc +0 -0
  17. models/__pycache__/perceptual_model.cpython-37.pyc +0 -0
  18. models/__pycache__/perceptual_model.cpython-39.pyc +0 -0
  19. models/__pycache__/pggan_discriminator.cpython-37.pyc +0 -0
  20. models/__pycache__/pggan_discriminator.cpython-39.pyc +0 -0
  21. models/__pycache__/pggan_generator.cpython-37.pyc +0 -0
  22. models/__pycache__/pggan_generator.cpython-39.pyc +0 -0
  23. models/__pycache__/pigan_discriminator.cpython-37.pyc +0 -0
  24. models/__pycache__/pigan_discriminator.cpython-39.pyc +0 -0
  25. models/__pycache__/pigan_generator.cpython-37.pyc +0 -0
  26. models/__pycache__/pigan_generator.cpython-39.pyc +0 -0
  27. models/__pycache__/sgbev3d_generator.cpython-37.pyc +0 -0
  28. models/__pycache__/sgbev3d_generator.cpython-39.pyc +0 -0
  29. models/__pycache__/stylegan2_discriminator.cpython-37.pyc +0 -0
  30. models/__pycache__/stylegan2_discriminator.cpython-39.pyc +0 -0
  31. models/__pycache__/stylegan2_generator.cpython-37.pyc +0 -0
  32. models/__pycache__/stylegan2_generator.cpython-39.pyc +0 -0
  33. models/__pycache__/stylegan3_generator.cpython-37.pyc +0 -0
  34. models/__pycache__/stylegan3_generator.cpython-39.pyc +0 -0
  35. models/__pycache__/stylegan_discriminator.cpython-37.pyc +0 -0
  36. models/__pycache__/stylegan_discriminator.cpython-39.pyc +0 -0
  37. models/__pycache__/stylegan_generator.cpython-37.pyc +0 -0
  38. models/__pycache__/stylegan_generator.cpython-39.pyc +0 -0
  39. models/__pycache__/volumegan_discriminator.cpython-37.pyc +0 -0
  40. models/__pycache__/volumegan_discriminator.cpython-39.pyc +0 -0
  41. models/__pycache__/volumegan_generator.cpython-37.pyc +0 -0
  42. models/__pycache__/volumegan_generator.cpython-39.pyc +0 -0
  43. models/rendering/__pycache__/__init__.cpython-37.pyc +0 -0
  44. models/rendering/__pycache__/__init__.cpython-39.pyc +0 -0
  45. models/rendering/__pycache__/feature_extractor.cpython-37.pyc +0 -0
  46. models/rendering/__pycache__/feature_extractor.cpython-39.pyc +0 -0
  47. models/rendering/__pycache__/integrator.cpython-37.pyc +0 -0
  48. models/rendering/__pycache__/integrator.cpython-39.pyc +0 -0
  49. models/rendering/__pycache__/point_sampler.cpython-37.pyc +0 -0
  50. models/rendering/__pycache__/point_sampler.cpython-39.pyc +0 -0
.gitignore ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ *.pyc
2
+ *.pth
app.py CHANGED
@@ -8,6 +8,7 @@ import ninja
8
  import torch
9
  from tqdm import trange
10
  import imageio
 
11
 
12
  print('load!', flush=True)
13
  checkpoint = 'clevr.pth'
@@ -233,38 +234,39 @@ RT = torch.tensor([[ -1.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.5000,
233
 
234
  print('prepare finish', flush=True)
235
 
236
- def inference(name):
237
  print('inference', name, flush=True)
238
  gen = G(code, RT, bevs)
239
  rgb = gen['gen_output']['image'][0] * .5 + .5
240
  print('inference', name, flush=True)
241
- return np.array(to_pil(rgb))
242
 
243
  # to_pil(rgb).save('tmp.png')
244
  # save_path = '/mnt/petrelfs/zhangqihang/code/3d-scene-gen/tmp.png'
245
  # return [save_path]
246
 
 
 
 
 
 
 
247
  with gr.Blocks() as demo:
248
  gr.HTML(
249
  """
250
- abc
251
  """)
252
 
253
- with gr.Group():
254
- with gr.Row():
255
- with gr.Column():
256
- with gr.Row():
257
- with gr.Column():
258
- with gr.Row():
259
- num_frames = gr.Dropdown(["24 - frames", "32 - frames", "40 - frames", "48 - frames", "56 - frames", "80 - recommended to run on local GPUs", "240 - recommended to run on local GPUs", "600 - recommended to run on local GPUs", "1200 - recommended to run on local GPUs", "10000 - recommended to run on local GPUs"], label="Number of Video Frames", info="For >56 frames use local workstation!", value="24 - frames")
260
 
261
- with gr.Row():
262
- with gr.Row():
263
- btn = gr.Button("Result")
264
-
265
- gallery = gr.Image(label='img', show_label=True, elem_id="gallery")
266
 
267
- btn.click(fn=inference, inputs=num_frames, outputs=[gallery], postprocess=False)
268
 
269
  demo.queue()
270
- demo.launch(server_name='0.0.0.0', server_port=7860, debug=True, show_error=True)
 
 
8
  import torch
9
  from tqdm import trange
10
  import imageio
11
+ import requests
12
 
13
  print('load!', flush=True)
14
  checkpoint = 'clevr.pth'
 
234
 
235
  print('prepare finish', flush=True)
236
 
237
+ def predict(name):
238
  print('inference', name, flush=True)
239
  gen = G(code, RT, bevs)
240
  rgb = gen['gen_output']['image'][0] * .5 + .5
241
  print('inference', name, flush=True)
242
+ return to_pil(rgb)
243
 
244
  # to_pil(rgb).save('tmp.png')
245
  # save_path = '/mnt/petrelfs/zhangqihang/code/3d-scene-gen/tmp.png'
246
  # return [save_path]
247
 
248
+ URL = "https://source.unsplash.com/random/500x500/?nature,fruit"
249
+
250
+ def refresh(name):
251
+ image = Image.open(requests.get(URL, stream=True).raw)
252
+ return image
253
+
254
  with gr.Blocks() as demo:
255
  gr.HTML(
256
  """
257
+ BerfScene demo
258
  """)
259
 
260
+ # gallery = gr.Image(show_label=False)
261
+ image = gr.Image(show_label=False)
262
+ btn = gr.Button("Result")
 
 
 
 
263
 
264
+ x = gr.Textbox(label="Prompt", show_label=False, lines=1, max_lines=1, info="Describe your subject (optional)", value="a person", elem_id="prompt")
265
+ btn.click(fn=predict, inputs=x, outputs=image)
266
+ # demo.load(fn=refresh, inputs=x, outputs=gallery, show_progress=False, every=1)
 
 
267
 
268
+ # btn.click(fn=predict, inputs=num_frames, outputs=gallery, postprocess=False)
269
 
270
  demo.queue()
271
+ demo.launch(server_name='0.0.0.0', server_port=10093, debug=True, show_error=True)
272
+ # demo.launch(server_name='0.0.0.0', server_port=7860, debug=True, show_error=True)
models/__pycache__/__init__.cpython-37.pyc DELETED
Binary file (2.06 kB)
 
models/__pycache__/__init__.cpython-39.pyc DELETED
Binary file (2.08 kB)
 
models/__pycache__/bev3d_generator.cpython-37.pyc DELETED
Binary file (6.16 kB)
 
models/__pycache__/bev3d_generator.cpython-39.pyc DELETED
Binary file (6.07 kB)
 
models/__pycache__/eg3d_discriminator.cpython-37.pyc DELETED
Binary file (8.01 kB)
 
models/__pycache__/eg3d_discriminator.cpython-39.pyc DELETED
Binary file (7.73 kB)
 
models/__pycache__/eg3d_generator.cpython-37.pyc DELETED
Binary file (6.21 kB)
 
models/__pycache__/eg3d_generator.cpython-39.pyc DELETED
Binary file (6.3 kB)
 
models/__pycache__/eg3d_generator_fv.cpython-37.pyc DELETED
Binary file (6.35 kB)
 
models/__pycache__/eg3d_generator_fv.cpython-39.pyc DELETED
Binary file (6.43 kB)
 
models/__pycache__/ghfeat_encoder.cpython-37.pyc DELETED
Binary file (14.3 kB)
 
models/__pycache__/ghfeat_encoder.cpython-39.pyc DELETED
Binary file (14.1 kB)
 
models/__pycache__/inception_model.cpython-37.pyc DELETED
Binary file (16 kB)
 
models/__pycache__/inception_model.cpython-39.pyc DELETED
Binary file (15.7 kB)
 
models/__pycache__/perceptual_model.cpython-37.pyc DELETED
Binary file (14.3 kB)
 
models/__pycache__/perceptual_model.cpython-39.pyc DELETED
Binary file (14 kB)
 
models/__pycache__/pggan_discriminator.cpython-37.pyc DELETED
Binary file (12 kB)
 
models/__pycache__/pggan_discriminator.cpython-39.pyc DELETED
Binary file (11.9 kB)
 
models/__pycache__/pggan_generator.cpython-37.pyc DELETED
Binary file (10.6 kB)
 
models/__pycache__/pggan_generator.cpython-39.pyc DELETED
Binary file (10.6 kB)
 
models/__pycache__/pigan_discriminator.cpython-37.pyc DELETED
Binary file (8.32 kB)
 
models/__pycache__/pigan_discriminator.cpython-39.pyc DELETED
Binary file (8.31 kB)
 
models/__pycache__/pigan_generator.cpython-37.pyc DELETED
Binary file (12.7 kB)
 
models/__pycache__/pigan_generator.cpython-39.pyc DELETED
Binary file (12.8 kB)
 
models/__pycache__/sgbev3d_generator.cpython-37.pyc DELETED
Binary file (7.01 kB)
 
models/__pycache__/sgbev3d_generator.cpython-39.pyc DELETED
Binary file (7.04 kB)
 
models/__pycache__/stylegan2_discriminator.cpython-37.pyc DELETED
Binary file (17.7 kB)
 
models/__pycache__/stylegan2_discriminator.cpython-39.pyc DELETED
Binary file (17.7 kB)
 
models/__pycache__/stylegan2_generator.cpython-37.pyc DELETED
Binary file (32.9 kB)
 
models/__pycache__/stylegan2_generator.cpython-39.pyc DELETED
Binary file (32.9 kB)
 
models/__pycache__/stylegan3_generator.cpython-37.pyc DELETED
Binary file (35.8 kB)
 
models/__pycache__/stylegan3_generator.cpython-39.pyc DELETED
Binary file (35.7 kB)
 
models/__pycache__/stylegan_discriminator.cpython-37.pyc DELETED
Binary file (15.9 kB)
 
models/__pycache__/stylegan_discriminator.cpython-39.pyc DELETED
Binary file (15.9 kB)
 
models/__pycache__/stylegan_generator.cpython-37.pyc DELETED
Binary file (24.9 kB)
 
models/__pycache__/stylegan_generator.cpython-39.pyc DELETED
Binary file (24.9 kB)
 
models/__pycache__/volumegan_discriminator.cpython-37.pyc DELETED
Binary file (17.8 kB)
 
models/__pycache__/volumegan_discriminator.cpython-39.pyc DELETED
Binary file (17.8 kB)
 
models/__pycache__/volumegan_generator.cpython-37.pyc DELETED
Binary file (18.2 kB)
 
models/__pycache__/volumegan_generator.cpython-39.pyc DELETED
Binary file (18.2 kB)
 
models/rendering/__pycache__/__init__.cpython-37.pyc DELETED
Binary file (454 Bytes)
 
models/rendering/__pycache__/__init__.cpython-39.pyc DELETED
Binary file (460 Bytes)
 
models/rendering/__pycache__/feature_extractor.cpython-37.pyc DELETED
Binary file (4.64 kB)
 
models/rendering/__pycache__/feature_extractor.cpython-39.pyc DELETED
Binary file (4.65 kB)
 
models/rendering/__pycache__/integrator.cpython-37.pyc DELETED
Binary file (3.92 kB)
 
models/rendering/__pycache__/integrator.cpython-39.pyc DELETED
Binary file (3.93 kB)
 
models/rendering/__pycache__/point_sampler.cpython-37.pyc DELETED
Binary file (28 kB)
 
models/rendering/__pycache__/point_sampler.cpython-39.pyc DELETED
Binary file (28.1 kB)