feat: new example
Browse files
assets/image_50.png
ADDED
|
src/model/__pycache__/model_registry.cpython-310.pyc
CHANGED
|
Binary files a/src/model/__pycache__/model_registry.cpython-310.pyc and b/src/model/__pycache__/model_registry.cpython-310.pyc differ
|
|
|
src/model/model_llava.py
CHANGED
|
@@ -71,7 +71,7 @@ def inference():
|
|
| 71 |
return text_outputs
|
| 72 |
|
| 73 |
|
| 74 |
-
@spaces.GPU
|
| 75 |
def inference_by_prompt_and_images(prompt, images):
|
| 76 |
device = "cuda"
|
| 77 |
if len(images) > 0 and type(images[0]) is str:
|
|
@@ -98,7 +98,7 @@ def inference_by_prompt_and_images(prompt, images):
|
|
| 98 |
|
| 99 |
return text_outputs
|
| 100 |
|
| 101 |
-
@spaces.GPU
|
| 102 |
def inference_by_prompt_and_images_fire(prompt, images):
|
| 103 |
device = "cuda"
|
| 104 |
if len(images) > 0 and type(images[0]) is str:
|
|
|
|
| 71 |
return text_outputs
|
| 72 |
|
| 73 |
|
| 74 |
+
@spaces.GPU
|
| 75 |
def inference_by_prompt_and_images(prompt, images):
|
| 76 |
device = "cuda"
|
| 77 |
if len(images) > 0 and type(images[0]) is str:
|
|
|
|
| 98 |
|
| 99 |
return text_outputs
|
| 100 |
|
| 101 |
+
@spaces.GPU
|
| 102 |
def inference_by_prompt_and_images_fire(prompt, images):
|
| 103 |
device = "cuda"
|
| 104 |
if len(images) > 0 and type(images[0]) is str:
|
src/serve/gradio_block_arena_vision_named.py
CHANGED
|
@@ -324,7 +324,10 @@ def build_side_by_side_vision_ui_named(models, random_questions=None):
|
|
| 324 |
bothbad_btn = gr.Button(
|
| 325 |
value="👎 Both are bad", visible=False, interactive=False
|
| 326 |
)
|
| 327 |
-
|
|
|
|
|
|
|
|
|
|
| 328 |
with gr.Row():
|
| 329 |
textbox = gr.MultimodalTextbox(
|
| 330 |
file_types=["image"],
|
|
@@ -347,8 +350,8 @@ def build_side_by_side_vision_ui_named(models, random_questions=None):
|
|
| 347 |
gr.Examples(examples=[
|
| 348 |
[
|
| 349 |
{
|
| 350 |
-
"files": ["assets/
|
| 351 |
-
"text": "
|
| 352 |
}
|
| 353 |
],
|
| 354 |
],inputs=[textbox])
|
|
@@ -379,7 +382,7 @@ def build_side_by_side_vision_ui_named(models, random_questions=None):
|
|
| 379 |
)
|
| 380 |
|
| 381 |
gr.Markdown(acknowledgment_md, elem_id="ack_markdown")
|
| 382 |
-
|
| 383 |
# Register listeners
|
| 384 |
btn_list = [
|
| 385 |
leftvote_btn,
|
|
@@ -450,6 +453,11 @@ function (a, b, c, d) {
|
|
| 450 |
textbox.input(add_image, [textbox], [imagebox]).then(
|
| 451 |
set_visible_image, [textbox], [image_column]
|
| 452 |
).then(clear_history_example, None, states + chatbots + btn_list)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 453 |
|
| 454 |
textbox.submit(
|
| 455 |
add_text,
|
|
@@ -461,6 +469,8 @@ function (a, b, c, d) {
|
|
| 461 |
states + chatbots + btn_list,
|
| 462 |
).then(
|
| 463 |
flash_buttons, [], btn_list
|
|
|
|
|
|
|
| 464 |
)
|
| 465 |
|
| 466 |
if random_questions:
|
|
|
|
| 324 |
bothbad_btn = gr.Button(
|
| 325 |
value="👎 Both are bad", visible=False, interactive=False
|
| 326 |
)
|
| 327 |
+
with gr.Row():
|
| 328 |
+
recommendation = gr.Textbox(
|
| 329 |
+
visible=False
|
| 330 |
+
)
|
| 331 |
with gr.Row():
|
| 332 |
textbox = gr.MultimodalTextbox(
|
| 333 |
file_types=["image"],
|
|
|
|
| 350 |
gr.Examples(examples=[
|
| 351 |
[
|
| 352 |
{
|
| 353 |
+
"files": ["assets/image_50.png"],
|
| 354 |
+
"text": "Please directly answer the question and provide the correct option letter, e.g., A, B, C, D.\nQuestion: As shown in the figure, then angle COE = ()\nChoices:\nA:30°\nB:140°\nC:50°\nD:60°"
|
| 355 |
}
|
| 356 |
],
|
| 357 |
],inputs=[textbox])
|
|
|
|
| 382 |
)
|
| 383 |
|
| 384 |
gr.Markdown(acknowledgment_md, elem_id="ack_markdown")
|
| 385 |
+
|
| 386 |
# Register listeners
|
| 387 |
btn_list = [
|
| 388 |
leftvote_btn,
|
|
|
|
| 453 |
textbox.input(add_image, [textbox], [imagebox]).then(
|
| 454 |
set_visible_image, [textbox], [image_column]
|
| 455 |
).then(clear_history_example, None, states + chatbots + btn_list)
|
| 456 |
+
def get_recommendation(chatbots):
|
| 457 |
+
|
| 458 |
+
logger.info(f"chatbots {chatbots}")
|
| 459 |
+
|
| 460 |
+
return [gr.Textbox(visible=True, value="Teacher Feedback Recommendation Content")]
|
| 461 |
|
| 462 |
textbox.submit(
|
| 463 |
add_text,
|
|
|
|
| 469 |
states + chatbots + btn_list,
|
| 470 |
).then(
|
| 471 |
flash_buttons, [], btn_list
|
| 472 |
+
).then(
|
| 473 |
+
get_recommendation, chatbots, [recommendation]
|
| 474 |
)
|
| 475 |
|
| 476 |
if random_questions:
|