jennysun commited on
Commit
116a165
β€’
1 Parent(s): 59e065f

Passing in language and grounding instruction as outputs after button is pressed to make changes

Browse files
Files changed (1) hide show
  1. app.py +16 -13
app.py CHANGED
@@ -525,7 +525,17 @@ def separate_subjects(input_text):
525
  temperature=0.7,
526
  )
527
  output_text = response.choices[0].text.strip()
528
- return output_text
 
 
 
 
 
 
 
 
 
 
529
 
530
  with Blocks(
531
  css=css,
@@ -569,10 +579,6 @@ with Blocks(
569
  btn = gr.Button("Gen")
570
  with gr.Column():
571
  separated_text = gr.Text(label="Subjects Separated by Semicolon")
572
- btn.click(separate_subjects, inputs=[seed], outputs=[separated_text])
573
-
574
- # language_instruction.value = seed
575
- # grounding_instruction.value = separated_text
576
  language_instruction = gr.Textbox(
577
  label="Language Instruction by User",
578
  value=seed,
@@ -583,6 +589,11 @@ with Blocks(
583
  value=separated_text,
584
  visible=False
585
  )
 
 
 
 
 
586
  ####################
587
  # language_instruction = gr.Textbox(
588
  # label="Enter your prompt here",
@@ -737,14 +748,6 @@ with Blocks(
737
  outputs=[out_gen_1, out_gen_2, out_gen_3, out_gen_4, state],
738
  queue=True
739
  )
740
- # start_btn.click(
741
- # update_grounding_instruction,
742
- # # inputs=[
743
- # # original_input,
744
- # # ],
745
- # # outputs=[separated_subjects],
746
- # # queue=True
747
- # )
748
  sketch_pad_resize_trigger.change(
749
  None,
750
  None,
 
525
  temperature=0.7,
526
  )
527
  output_text = response.choices[0].text.strip()
528
+ language_instruction = gr.Textbox(
529
+ label="Language Instruction by User",
530
+ value=input_text,
531
+ visible=False
532
+ )
533
+ grounding_instruction = gr.Textbox(
534
+ label="Subjects in image (Separated by semicolon)",
535
+ value=output_text,
536
+ visible=False
537
+ )
538
+ return output_text, language_instruction, grounding_instruction
539
 
540
  with Blocks(
541
  css=css,
 
579
  btn = gr.Button("Gen")
580
  with gr.Column():
581
  separated_text = gr.Text(label="Subjects Separated by Semicolon")
 
 
 
 
582
  language_instruction = gr.Textbox(
583
  label="Language Instruction by User",
584
  value=seed,
 
589
  value=separated_text,
590
  visible=False
591
  )
592
+ btn.click(separate_subjects, inputs=[seed], outputs=[separated_text, language_instruction, grounding_instruction])
593
+
594
+ # language_instruction.value = seed
595
+ # grounding_instruction.value = separated_text
596
+
597
  ####################
598
  # language_instruction = gr.Textbox(
599
  # label="Enter your prompt here",
 
748
  outputs=[out_gen_1, out_gen_2, out_gen_3, out_gen_4, state],
749
  queue=True
750
  )
 
 
 
 
 
 
 
 
751
  sketch_pad_resize_trigger.change(
752
  None,
753
  None,