Spaces:
Runtime error
Runtime error
JJteam
commited on
Commit
•
93e0370
1
Parent(s):
9189a48
updating title and release note
Browse files- .gitattributes +1 -0
- MM-REACT/app.py +17 -10
- MM-REACT/images/cartoon.png +3 -0
- MM-REACT/images/celebrity.png +3 -0
- MM-REACT/images/money.png +0 -0
- MM-REACT/images/product.png +3 -0
- MM-REACT/images/receipt.png +0 -0
.gitattributes
CHANGED
@@ -32,3 +32,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
32 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
33 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
34 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
32 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
33 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
34 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
35 |
+
*.png filter=lfs diff=lfs merge=lfs -text
|
MM-REACT/app.py
CHANGED
@@ -26,8 +26,9 @@ logger = None
|
|
26 |
|
27 |
|
28 |
OPENAI_API_KEY = os.environ.get("OPENAI_API_KEY")
|
29 |
-
BUG_FOUND_MSG = "
|
30 |
AUTH_ERR_MSG = "OpenAI key needed"
|
|
|
31 |
MAX_TOKENS = 512
|
32 |
|
33 |
|
@@ -368,14 +369,18 @@ def replace_with_image_markup(text):
|
|
368 |
# multi line response handling
|
369 |
def process_chain_output(outputs):
|
370 |
global ARGS
|
|
|
371 |
# print("outputs {}".format(outputs))
|
372 |
if isinstance(outputs, str): # single line output
|
|
|
|
|
373 |
outputs = [outputs]
|
374 |
elif isinstance(outputs, list): # multi line output
|
375 |
if ARGS.noIntermediateConv: # remove the items with assistant in it.
|
376 |
cleanOutputs = []
|
377 |
for output in outputs:
|
378 |
-
|
|
|
379 |
# found an edited image url to embed
|
380 |
img_url = None
|
381 |
# print ("type list: {}".format(output))
|
@@ -398,6 +403,7 @@ def init_and_kick_off():
|
|
398 |
chat = ChatWrapper()
|
399 |
|
400 |
exampleTitle = """<h3>Examples to start conversation..</h3>"""
|
|
|
401 |
|
402 |
with gr.Blocks(css="#tryButton {width: 120px;}") as block:
|
403 |
llm_state = gr.State()
|
@@ -406,6 +412,7 @@ def init_and_kick_off():
|
|
406 |
log_state = gr.State()
|
407 |
|
408 |
reset_btn = gr.Button(value="!!!CLICK to wake up MM-REACT!!!", variant="primary", elem_id="resetbtn").style(full_width=True)
|
|
|
409 |
|
410 |
example_image_size = 90
|
411 |
col_min_width = 80
|
@@ -432,25 +439,26 @@ def init_and_kick_off():
|
|
432 |
example1ImagePath = gr.Text("images/money.png", interactive=False, visible=False)
|
433 |
with gr.Row():
|
434 |
with gr.Column(scale=0.50, min_width=col_min_width):
|
435 |
-
example2Image = gr.Image("images/
|
436 |
with gr.Column(scale=0.50, min_width=col_min_width):
|
437 |
example2ImageButton = gr.Button(elem_id="tryButton", value="Try it!", variant=button_variant).style(full_width=True)
|
438 |
# dummy text field to hold the path
|
439 |
-
example2ImagePath = gr.Text("images/
|
440 |
with gr.Row():
|
441 |
with gr.Column(scale=0.50, min_width=col_min_width):
|
442 |
-
example4Image = gr.Image("images/
|
443 |
with gr.Column(scale=0.50, min_width=col_min_width):
|
444 |
example4ImageButton = gr.Button(elem_id="tryButton", value="Try it!", variant=button_variant).style(full_width=True)
|
445 |
# dummy text field to hold the path
|
446 |
-
example4ImagePath = gr.Text("images/
|
447 |
with gr.Row():
|
448 |
with gr.Column(scale=0.50, min_width=col_min_width):
|
449 |
-
example5Image = gr.Image("images/
|
450 |
with gr.Column(scale=0.50, min_width=col_min_width):
|
451 |
example5ImageButton = gr.Button(elem_id="tryButton", value="Try it!", variant=button_variant).style(full_width=True)
|
452 |
# dummy text field to hold the path
|
453 |
-
example5ImagePath = gr.Text("images/
|
|
|
454 |
|
455 |
|
456 |
with gr.Row():
|
@@ -494,5 +502,4 @@ if __name__ == '__main__':
|
|
494 |
global ARGS
|
495 |
ARGS = parser.parse_args()
|
496 |
|
497 |
-
init_and_kick_off()
|
498 |
-
|
|
|
26 |
|
27 |
|
28 |
OPENAI_API_KEY = os.environ.get("OPENAI_API_KEY")
|
29 |
+
BUG_FOUND_MSG = "Some Functionalities not supported yet. Please refresh and hit 'Click to wake up MM-REACT'"
|
30 |
AUTH_ERR_MSG = "OpenAI key needed"
|
31 |
+
REFRESH_MSG = "Please refresh and hit 'Click to wake up MM-REACT'"
|
32 |
MAX_TOKENS = 512
|
33 |
|
34 |
|
|
|
369 |
# multi line response handling
|
370 |
def process_chain_output(outputs):
|
371 |
global ARGS
|
372 |
+
EMPTY_AI_REPLY = "AI:"
|
373 |
# print("outputs {}".format(outputs))
|
374 |
if isinstance(outputs, str): # single line output
|
375 |
+
if outputs.strip() == EMPTY_AI_REPLY:
|
376 |
+
outputs = REFRESH_MSG
|
377 |
outputs = [outputs]
|
378 |
elif isinstance(outputs, list): # multi line output
|
379 |
if ARGS.noIntermediateConv: # remove the items with assistant in it.
|
380 |
cleanOutputs = []
|
381 |
for output in outputs:
|
382 |
+
if output.strip() == EMPTY_AI_REPLY:
|
383 |
+
output = REFRESH_MSG
|
384 |
# found an edited image url to embed
|
385 |
img_url = None
|
386 |
# print ("type list: {}".format(output))
|
|
|
403 |
chat = ChatWrapper()
|
404 |
|
405 |
exampleTitle = """<h3>Examples to start conversation..</h3>"""
|
406 |
+
comingSoon = """<center><b><p style="color:Red;">MMREACT: March 21th version with image understanding capabilities</p></b></center>"""
|
407 |
|
408 |
with gr.Blocks(css="#tryButton {width: 120px;}") as block:
|
409 |
llm_state = gr.State()
|
|
|
412 |
log_state = gr.State()
|
413 |
|
414 |
reset_btn = gr.Button(value="!!!CLICK to wake up MM-REACT!!!", variant="primary", elem_id="resetbtn").style(full_width=True)
|
415 |
+
gr.HTML(comingSoon)
|
416 |
|
417 |
example_image_size = 90
|
418 |
col_min_width = 80
|
|
|
439 |
example1ImagePath = gr.Text("images/money.png", interactive=False, visible=False)
|
440 |
with gr.Row():
|
441 |
with gr.Column(scale=0.50, min_width=col_min_width):
|
442 |
+
example2Image = gr.Image("images/cartoon.png", interactive=False).style(height=example_image_size, width=example_image_size)
|
443 |
with gr.Column(scale=0.50, min_width=col_min_width):
|
444 |
example2ImageButton = gr.Button(elem_id="tryButton", value="Try it!", variant=button_variant).style(full_width=True)
|
445 |
# dummy text field to hold the path
|
446 |
+
example2ImagePath = gr.Text("images/cartoon.png", interactive=False, visible=False)
|
447 |
with gr.Row():
|
448 |
with gr.Column(scale=0.50, min_width=col_min_width):
|
449 |
+
example4Image = gr.Image("images/product.png", interactive=False).style(height=example_image_size, width=example_image_size)
|
450 |
with gr.Column(scale=0.50, min_width=col_min_width):
|
451 |
example4ImageButton = gr.Button(elem_id="tryButton", value="Try it!", variant=button_variant).style(full_width=True)
|
452 |
# dummy text field to hold the path
|
453 |
+
example4ImagePath = gr.Text("images/product.png", interactive=False, visible=False)
|
454 |
with gr.Row():
|
455 |
with gr.Column(scale=0.50, min_width=col_min_width):
|
456 |
+
example5Image = gr.Image("images/celebrity.png", interactive=False).style(height=example_image_size, width=example_image_size)
|
457 |
with gr.Column(scale=0.50, min_width=col_min_width):
|
458 |
example5ImageButton = gr.Button(elem_id="tryButton", value="Try it!", variant=button_variant).style(full_width=True)
|
459 |
# dummy text field to hold the path
|
460 |
+
example5ImagePath = gr.Text("images/celebrity.png", interactive=False, visible=False)
|
461 |
+
|
462 |
|
463 |
|
464 |
with gr.Row():
|
|
|
502 |
global ARGS
|
503 |
ARGS = parser.parse_args()
|
504 |
|
505 |
+
init_and_kick_off()
|
|
MM-REACT/images/cartoon.png
ADDED
Git LFS Details
|
MM-REACT/images/celebrity.png
ADDED
Git LFS Details
|
MM-REACT/images/money.png
CHANGED
Git LFS Details
|
MM-REACT/images/product.png
ADDED
Git LFS Details
|
MM-REACT/images/receipt.png
CHANGED
Git LFS Details
|