revert
Browse files
app.py
CHANGED
|
@@ -6,12 +6,23 @@ chatbot = pipeline(model="llms-lab/LLaVA-NeXT-Video-32BQwen")
|
|
| 6 |
message_list = []
|
| 7 |
response_list = []
|
| 8 |
|
| 9 |
-
def vanilla_chatbot(message, history):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
conversation = Conversation(text=message, past_user_inputs=message_list, generated_responses=response_list)
|
| 11 |
conversation = chatbot(conversation)
|
| 12 |
|
| 13 |
return conversation.generated_responses[-1]
|
| 14 |
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
-
|
|
|
|
| 6 |
message_list = []
|
| 7 |
response_list = []
|
| 8 |
|
| 9 |
+
def vanilla_chatbot(message, history, file=None):
|
| 10 |
+
if file is not None:
|
| 11 |
+
# Handle file processing here
|
| 12 |
+
file_content = file.read()
|
| 13 |
+
message += f"\n\nFile content:\n{file_content.decode('utf-8')}"
|
| 14 |
+
|
| 15 |
conversation = Conversation(text=message, past_user_inputs=message_list, generated_responses=response_list)
|
| 16 |
conversation = chatbot(conversation)
|
| 17 |
|
| 18 |
return conversation.generated_responses[-1]
|
| 19 |
|
| 20 |
+
chatbot_interface = gr.Interface(
|
| 21 |
+
fn=vanilla_chatbot,
|
| 22 |
+
inputs=[gr.inputs.Textbox(lines=2, placeholder="Enter your message here..."), gr.inputs.File(optional=True)],
|
| 23 |
+
outputs="text",
|
| 24 |
+
title="Vanilla Chatbot",
|
| 25 |
+
description="Enter text to start chatting or upload a file."
|
| 26 |
+
)
|
| 27 |
|
| 28 |
+
chatbot_interface.launch()
|