test / app.py
AhmadMustafa's picture
Update app.py
1336ceb verified
raw
history blame
1.29 kB
import gradio as gr
from ultralytics import YOLO
model = YOLO("yolo11n.pt")
def create_minimal_chat_interface():
"""Create a stripped-down minimal chat interface for debugging."""
with gr.Blocks() as demo:
# Basic chatbot with no additional parameters
chatbot = gr.Chatbot(
show_label=False,
)
# Simple textbox for input
msg = gr.Textbox(
show_label=False,
placeholder="Type your message here..."
)
def respond(message, chat_history):
"""Simple echo function for testing."""
chat_history.append((message, f"You said: {message}"))
return "", chat_history
msg.submit(
respond,
[msg, chatbot],
[msg, chatbot],
)
# Simple load function with no request parameter
def on_load():
chatbot_value = [(None, "Welcome! This is a minimal test interface.")]
return chatbot_value
demo.load(
on_load,
inputs=None,
outputs=[chatbot],
)
return demo
# Launch the application
if __name__ == "__main__":
app = create_minimal_chat_interface()
app.launch()