jeremyrmanning commited on
Commit
fb85cfd
·
1 Parent(s): 4a90bbb

change how inputs are entered

Browse files
Files changed (1) hide show
  1. app.py +10 -14
app.py CHANGED
@@ -54,10 +54,10 @@ def generate_images(text, width=256, height=256, steps=50, num_images=1, diversi
54
  return generated_images
55
 
56
 
57
- def generate_interpolation(text, n=4):
58
  generated_images = []
59
- for t in text:
60
- generated_images.extend(generate_images(t))
61
 
62
  frames = []
63
  for i, g in enumerate(generated_images):
@@ -66,21 +66,17 @@ def generate_interpolation(text, n=4):
66
 
67
  frames = list(util.interpolate_recursively_from_files(frames, n, interpolator))
68
 
69
- mediapy.write_video("out.mp4", frames, fps=7)
70
 
71
  return "out.mp4"
72
 
73
 
74
- demo = gr.Blocks()
 
75
  with demo:
76
- x1 = gr.Textbox(placeholder='human', label='Text 1')
77
- x2 = gr.Textbox(placeholder='human head', label='Text 2')
78
- x3 = gr.Textbox(placeholder='brain', label='Text 3')
79
- x4 = gr.Textbox(placeholder='brain in a computer', label='Text 4')
80
- x5 = gr.Textbox(placeholder='humanoid robot', label='Text 5')
81
-
82
- button_gen_video = gr.Button("Generate Video")
83
- output_interpolation = gr.Video(label="Generated Video")
84
- button_gen_video.click(fn=generate_interpolation, inputs=[[x1, x2, x3, x4, x5]], outputs=output_interpolation)
85
 
86
  demo.launch(debug=True, enable_queue=True)
 
54
  return generated_images
55
 
56
 
57
+ def generate_interpolation(text, n=4):
58
  generated_images = []
59
+ for t in text.split(','):
60
+ generated_images.extend(generate_images(t.strip()))
61
 
62
  frames = []
63
  for i, g in enumerate(generated_images):
 
66
 
67
  frames = list(util.interpolate_recursively_from_files(frames, n, interpolator))
68
 
69
+ mediapy.write_video("out.mp4", frames, fps=10)
70
 
71
  return "out.mp4"
72
 
73
 
74
+ demo = gr.Blocks()
75
+
76
  with demo:
77
+ text = gr.Textbox(placeholder='human, human head, brain, brain in a computer, humanoid robot', label='input a comma-separated list of terms')
78
+ button_gen_video = gr.Button("Generate Video")
79
+ output_interpolation = gr.Video(label="Generated Video")
80
+ button_gen_video.click(fn=generate_interpolation, inputs=[text], outputs=output_interpolation)
 
 
 
 
 
81
 
82
  demo.launch(debug=True, enable_queue=True)