Spaces:
Sleeping
Sleeping
Create App.py
Browse files1234567891011121314151617181920212223242526272829303132import gradio as grfrom self_learning_bot import UnrestrictedChatbot
bot = UnrestrictedChatbot()
def respond(message, history): response = bot.chat(message) bot.save_state() # Auto-learn persistently if history is None: history = [] history.append((message, response)) return history, history
with gr.Blocks() as demo: gr.Markdown("# Phoenix AI (Self-Learning Chatbot)") gr.Markdown("Unrestricted, self-improving chatbot running on Hugging Face Spaces.") chatbot = gr.Chatbot(height=480) state = gr.State([]) with gr.Row(): txt = gr.Textbox( show_label=False, placeholder="Type your message here...", container=False, ) txt.submit(respond, [txt, state], [chatbot, state]) txt.submit(lambda: "", None, txt)
if __name__ == "__main__": demo.launch()App.pyAdded+32