Spaces:
Runtime error
Runtime error
Removing auto appending of grounding argument
Browse filesChecking to see if we can bypass errors of the auto append function and set the value as the seed (user's input)
app.py
CHANGED
@@ -305,8 +305,9 @@ Please draw boxes accordingly on the sketch pad.""".format(len(boxes), len(groun
|
|
305 |
boxes = boxes.tolist()
|
306 |
grounding_instruction = json.dumps({obj: box for obj,box in zip(grounding_texts, boxes) if obj != 'auto'})
|
307 |
|
308 |
-
|
309 |
-
|
|
|
310 |
|
311 |
gen_images, gen_overlays = inference(
|
312 |
task, language_instruction, grounding_instruction, boxes, image,
|
@@ -498,7 +499,7 @@ function(x) {
|
|
498 |
# Set up OpenAI API key
|
499 |
openai.api_key = os.environ['OPENAI_API_KEY']
|
500 |
|
501 |
-
prompt_base = 'Separate the subjects in this sentence by semicolons. For example, the sentence "a tiger and a horse running" should output "tiger; horse". If there are numbers, make each subject unique. For example, "2 dogs and 1 duck" would be "dog; dog; duck." Do the same for the following sentence: \n'
|
502 |
|
503 |
original_input = ""
|
504 |
separated_subjects = ""
|
@@ -544,12 +545,12 @@ with Blocks(
|
|
544 |
new_image_trigger = gr.Number(value=0, visible=False)
|
545 |
|
546 |
# UNCOMMENT THIS WHEN YOU WANT TO TOGGLE INPAINTING OPTION
|
547 |
-
task = gr.Radio(
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
)
|
553 |
|
554 |
# language_instruction = gr.Textbox(
|
555 |
# label="Enter your prompt here",
|
@@ -578,7 +579,6 @@ with Blocks(
|
|
578 |
print("separated_text", separated_text)
|
579 |
grounding_instruction=separated_text
|
580 |
print("grounding instrcc", grounding_instruction)
|
581 |
-
|
582 |
# language_instruction.value = seed
|
583 |
# grounding_instruction.value = separated_text
|
584 |
|
@@ -602,7 +602,7 @@ with Blocks(
|
|
602 |
# visible=False
|
603 |
# )
|
604 |
|
605 |
-
print("Language instruction:", language_instruction.value)
|
606 |
print("Grounding instruction:", grounding_instruction.value)
|
607 |
|
608 |
|
|
|
305 |
boxes = boxes.tolist()
|
306 |
grounding_instruction = json.dumps({obj: box for obj,box in zip(grounding_texts, boxes) if obj != 'auto'})
|
307 |
|
308 |
+
# Try to remove append grounding
|
309 |
+
# if append_grounding:
|
310 |
+
# language_instruction = auto_append_grounding(language_instruction, grounding_texts)
|
311 |
|
312 |
gen_images, gen_overlays = inference(
|
313 |
task, language_instruction, grounding_instruction, boxes, image,
|
|
|
499 |
# Set up OpenAI API key
|
500 |
openai.api_key = os.environ['OPENAI_API_KEY']
|
501 |
|
502 |
+
prompt_base = 'Separate the subjects in this sentence by semicolons. For example, the sentence "a tiger and a horse running in a greenland" should output "tiger; horse". If there are numbers, make each subject unique. For example, "2 dogs and 1 duck" would be "dog; dog; duck." Do the same for the following sentence: \n'
|
503 |
|
504 |
original_input = ""
|
505 |
separated_subjects = ""
|
|
|
545 |
new_image_trigger = gr.Number(value=0, visible=False)
|
546 |
|
547 |
# UNCOMMENT THIS WHEN YOU WANT TO TOGGLE INPAINTING OPTION
|
548 |
+
# task = gr.Radio(
|
549 |
+
# choices=["Version 1: Single Layer", 'Version 2: Inpainting w/ Multiple Layers'],
|
550 |
+
# type="value",
|
551 |
+
# value="Grounded Generation",
|
552 |
+
# label="Task",
|
553 |
+
# )
|
554 |
|
555 |
# language_instruction = gr.Textbox(
|
556 |
# label="Enter your prompt here",
|
|
|
579 |
print("separated_text", separated_text)
|
580 |
grounding_instruction=separated_text
|
581 |
print("grounding instrcc", grounding_instruction)
|
|
|
582 |
# language_instruction.value = seed
|
583 |
# grounding_instruction.value = separated_text
|
584 |
|
|
|
602 |
# visible=False
|
603 |
# )
|
604 |
|
605 |
+
print("Language instruction Value:", language_instruction.value)
|
606 |
print("Grounding instruction:", grounding_instruction.value)
|
607 |
|
608 |
|