#!/usr/bin/env python3 import gradio as gr import time from datetime import datetime # Simple fallback functions def simple_process_query(query): return f"Echo response: {query} (processed at {datetime.now().strftime('%H:%M:%S')})" def simple_chat(message, history): if not message.strip(): return history, "" response = simple_process_query(message) new_history = history + [[message, response]] return new_history, "" # Create simple demo with gr.Blocks(title="Simple Wisal Demo") as demo: gr.Markdown("# 🧠 Wisal - Simple Demo") with gr.Row(): with gr.Column(): chatbot = gr.Chatbot( label="💬 Chat with Wisal", height=400 ) with gr.Row(): msg = gr.Textbox( placeholder="Type your message here...", label="Message", scale=4 ) send_btn = gr.Button("Send", variant="primary") clear_btn = gr.Button("Clear Chat") # Event handlers send_btn.click( simple_chat, inputs=[msg, chatbot], outputs=[chatbot, msg] ) msg.submit( simple_chat, inputs=[msg, chatbot], outputs=[chatbot, msg] ) clear_btn.click( lambda: ([], ""), outputs=[chatbot, msg] ) if __name__ == "__main__": print("Starting simple demo...") demo.launch( server_name="localhost", server_port=7862, share=False, show_error=True )