sym / app.py
symlink's picture
revert
25692b8
raw
history blame
913 Bytes
from transformers import pipeline, Conversation
import gradio as gr
chatbot = pipeline(model="llms-lab/LLaVA-NeXT-Video-32BQwen")
message_list = []
response_list = []
def vanilla_chatbot(message, history, file=None):
if file is not None:
# Handle file processing here
file_content = file.read()
message += f"\n\nFile content:\n{file_content.decode('utf-8')}"
conversation = Conversation(text=message, past_user_inputs=message_list, generated_responses=response_list)
conversation = chatbot(conversation)
return conversation.generated_responses[-1]
chatbot_interface = gr.Interface(
fn=vanilla_chatbot,
inputs=[gr.inputs.Textbox(lines=2, placeholder="Enter your message here..."), gr.inputs.File(optional=True)],
outputs="text",
title="Vanilla Chatbot",
description="Enter text to start chatting or upload a file."
)
chatbot_interface.launch()