Spaces:
Sleeping
Sleeping
File size: 1,000 Bytes
0e37c10 f870519 0e37c10 e294f91 0e37c10 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
"""
File: module_vision.py
Description: A module for chat using image + text with a multimodal interface.
Author: Didier Guillevic
Date: 2025-05-08
"""
import gradio as gr
import vlm
def process(message, history):
"""Generate the model response given message and history
"""
messages = vlm.build_messages(message, history)
yield from vlm.stream_response(messages)
#examples=[
# [{"text": "What is happening in the video?", "files": ["Usain_Bolt_floats_to_victory.mp4"]}],
# [{"text": "Pourrais-tu décrire cette image?", "files": ["le_monde_2025-04-01.jpg"]}],
# [{"text": "Could you descrive the video?", "files": ["threads_brittlestar_post_DIABZcnJ.mp4"]}],
#]
#
# User interface
#
with gr.Blocks() as demo:
chat_interface = gr.ChatInterface(
fn=process,
description="Chat with text / text+image.",
#examples=examples,
#cache_examples=False,
stop_btn="Stop Generation",
multimodal=True,
type="messages"
)
|