Vipitis commited on
Commit
0680c21
1 Parent(s): 46dd33b

restructure

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -144,7 +144,7 @@ If I find an efficient way, the shaders might run in real time and be interactiv
144
  - [x] use embedded Shadertoy for reference/attribution (done, but some errors)
145
  - [] working render implementation on CPU only space (use the browser for WebGPU?)
146
  - [~] generate variations of return statements [ShaderEval task1](https://huggingface.co/spaces/Vipitis/ShaderEval) (missing all of the generation parameters)
147
- - [] generation history stating which function and orig/generated returns. (use State ??).
148
  - [] generate whole functions
149
  - [] generate whole shaders (via prompts?)
150
  """
@@ -247,15 +247,17 @@ with gr.Blocks() as site:
247
  run_button = gr.Button("generate a alternate return statement for one function", label="generate code")
248
  render_button = gr.Button("render frame0 (can carsh the sapce on invalid shadercode)",label="render frame")
249
  time_slider = gr.Slider(minimum=0, maximum=10, value=0, label="time (update on release, also used to pick other functions as a bodge)", step=0.02)
250
- #output = gr.Textbox(label="Output")
251
- rendered_frame = gr.Image(shape=(512, 420), label=f"rendered frame preview")
252
- # info_md = gr.Markdown(value="code_source", label="source URL for this shader", interactive=False)
253
- source_embed = gr.HTML('<iframe width="640" height="360" frameborder="0" src="https://www.shadertoy.com/embed/WsBcWV?gui=true&t=0&paused=true&muted=true" allowfullscreen></iframe>', label="How this shader originally renders")
254
- sample_code = gr.Code(label="Current Code (will update changes you generate)", language=None, readonly=True, lines=20)
 
255
  sample_pass = gr.State(value={})
256
  pipe = gr.State(value=PIPE)
257
  # hist_state = gr.State(Value={})
258
  # history_table = gr.JSON()
 
259
  model_cp.submit(fn=_make_pipeline, inputs=[model_cp], outputs=[pipe])
260
  sample_idx.release(fn=grab_sample, inputs=[sample_idx], outputs=[sample_pass, sample_code, source_embed])
261
  run_button.click(fn=alter_return, inputs=[sample_code, time_slider, pipe], outputs=[sample_code])
 
144
  - [x] use embedded Shadertoy for reference/attribution (done, but some errors)
145
  - [] working render implementation on CPU only space (use the browser for WebGPU?)
146
  - [~] generate variations of return statements [ShaderEval task1](https://huggingface.co/spaces/Vipitis/ShaderEval) (missing all of the generation parameters)
147
+ - [] generation history stating which function and orig/generated returns. (use State ??). do it as comments in the code?
148
  - [] generate whole functions
149
  - [] generate whole shaders (via prompts?)
150
  """
 
247
  run_button = gr.Button("generate a alternate return statement for one function", label="generate code")
248
  render_button = gr.Button("render frame0 (can carsh the sapce on invalid shadercode)",label="render frame")
249
  time_slider = gr.Slider(minimum=0, maximum=10, value=0, label="time (update on release, also used to pick other functions as a bodge)", step=0.02)
250
+ with gr.Row():
251
+ with gr.Column():
252
+ source_embed = gr.HTML('<iframe width="640" height="360" frameborder="0" src="https://www.shadertoy.com/embed/WsBcWV?gui=true&t=0&paused=true&muted=true" allowfullscreen></iframe>', label="How this shader originally renders")
253
+ rendered_frame = gr.Image(shape=(512, 420), label=f"rendered frame preview")
254
+ sample_code = gr.Code(label="Current Code (will update changes you generate)", language=None, readonly=True, lines=20)
255
+
256
  sample_pass = gr.State(value={})
257
  pipe = gr.State(value=PIPE)
258
  # hist_state = gr.State(Value={})
259
  # history_table = gr.JSON()
260
+
261
  model_cp.submit(fn=_make_pipeline, inputs=[model_cp], outputs=[pipe])
262
  sample_idx.release(fn=grab_sample, inputs=[sample_idx], outputs=[sample_pass, sample_code, source_embed])
263
  run_button.click(fn=alter_return, inputs=[sample_code, time_slider, pipe], outputs=[sample_code])