jennysun commited on
Commit
5e3ac87
β€’
1 Parent(s): 92eada7

Set language_instruction as the user_input after user submits their initial language prompt

Browse files
Files changed (1) hide show
  1. app.py +15 -13
app.py CHANGED
@@ -195,8 +195,6 @@ def inference(task, language_instruction, grounding_instruction, inpainting_boxe
195
  if task == 'Grounded Inpainting':
196
  alpha_sample = 1.0
197
 
198
- print("phrase list before declaring instruction", phrase_list)
199
-
200
  instruction = dict(
201
  prompt = language_instruction,
202
  phrases = phrase_list,
@@ -214,6 +212,8 @@ def inference(task, language_instruction, grounding_instruction, inpainting_boxe
214
  inpainting_boxes_nodrop = inpainting_boxes_nodrop,
215
  )
216
 
 
 
217
  get_model = partial(instance.get_model,
218
  batch_size=batch_size,
219
  instruction=language_instruction,
@@ -568,21 +568,23 @@ with Blocks(
568
 
569
  # EXPERIMENTING:
570
  with gr.Column():
571
- seed = gr.Text(label="Enter your prompt here:")
572
- gr.Examples(["2 horses running", "A cowboy and ninja fighting", "An apple and an orange on a table"], inputs=[seed])
573
  with gr.Column():
574
  btn = gr.Button("Gen")
575
  with gr.Column():
576
  separated_text = gr.Text(label="Subjects Separated by Semicolon")
577
- btn.click(separate_subjects, inputs=[seed], outputs=[separated_text])
578
- language_instruction = gr.Textbox(
579
- label="Language Instruction by User",
580
- value=seed,
581
- visible=False
582
- )
583
  print("separated_text", separated_text)
 
584
  grounding_instruction=separated_text
585
- print("grounding instrcc", grounding_instruction)
 
586
  # language_instruction.value = seed
587
  # grounding_instruction.value = separated_text
588
 
@@ -606,8 +608,8 @@ with Blocks(
606
  # visible=False
607
  # )
608
 
609
- print("Language instruction Value:", language_instruction.value)
610
- print("Grounding instruction:", grounding_instruction.value)
611
 
612
 
613
  ####################
 
195
  if task == 'Grounded Inpainting':
196
  alpha_sample = 1.0
197
 
 
 
198
  instruction = dict(
199
  prompt = language_instruction,
200
  phrases = phrase_list,
 
212
  inpainting_boxes_nodrop = inpainting_boxes_nodrop,
213
  )
214
 
215
+ print("instruction values", instruction)
216
+
217
  get_model = partial(instance.get_model,
218
  batch_size=batch_size,
219
  instruction=language_instruction,
 
568
 
569
  # EXPERIMENTING:
570
  with gr.Column():
571
+ user_input = gr.Text(label="Enter your prompt here:")
572
+ gr.Examples(["2 horses running", "A cowboy and ninja fighting", "An apple and an orange on a table"], inputs=[user_input])
573
  with gr.Column():
574
  btn = gr.Button("Gen")
575
  with gr.Column():
576
  separated_text = gr.Text(label="Subjects Separated by Semicolon")
577
+ btn.click(separate_subjects, inputs=[user_input], outputs=[separated_text])
578
+ # language_instruction = gr.Textbox(
579
+ # label="Language Instruction by User",
580
+ # value=seed,
581
+ # visible=False
582
+ # )
583
  print("separated_text", separated_text)
584
+ language_instruction=user_input
585
  grounding_instruction=separated_text
586
+ print("language_instruction after blocks: ", language_instruction)
587
+ print("grounding_instruction after blocks: ", language_instruction)
588
  # language_instruction.value = seed
589
  # grounding_instruction.value = separated_text
590
 
 
608
  # visible=False
609
  # )
610
 
611
+ # print("Language instruction Value:", language_instruction.value)
612
+ # print("Grounding instruction:", grounding_instruction.value)
613
 
614
 
615
  ####################