video datasets

Former-commit-id: 8cafc7b055
This commit is contained in:
hiyouga
2024-09-05 02:04:17 +08:00
parent 60d770e4b1
commit 9df7a26e6b
27 changed files with 420 additions and 148 deletions

View File

@@ -43,8 +43,12 @@ def create_chat_box(
system = gr.Textbox(show_label=False)
tools = gr.Textbox(show_label=False, lines=3)
with gr.Column() as image_box:
image = gr.Image(sources=["upload"], type="pil")
with gr.Column() as mm_box:
with gr.Tab("Image"):
image = gr.Image(sources=["upload"], type="pil")
with gr.Tab("Video"):
video = gr.Video(sources=["upload"])
query = gr.Textbox(show_label=False, lines=8)
submit_btn = gr.Button(variant="primary")
@@ -63,7 +67,7 @@ def create_chat_box(
[chatbot, messages, query],
).then(
engine.chatter.stream,
[chatbot, messages, system, tools, image, max_new_tokens, top_p, temperature],
[chatbot, messages, system, tools, image, video, max_new_tokens, top_p, temperature],
[chatbot, messages],
)
clear_btn.click(lambda: ([], []), outputs=[chatbot, messages])
@@ -76,8 +80,9 @@ def create_chat_box(
role=role,
system=system,
tools=tools,
image_box=image_box,
mm_box=mm_box,
image=image,
video=video,
query=query,
submit_btn=submit_btn,
max_new_tokens=max_new_tokens,

View File

@@ -68,7 +68,7 @@ def create_infer_tab(engine: "Engine") -> Dict[str, "Component"]:
engine.manager.get_elem_by_id("top.model_name").change(
lambda model_name: gr.Column(visible=get_visual(model_name)),
[engine.manager.get_elem_by_id("top.model_name")],
[chat_elems["image_box"]],
[chat_elems["mm_box"]],
)
return elem_dict