Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from transformers import pipeline | |
| # Initialize text-generation pipeline with GPT-2 or any HF-compatible model | |
| generator = pipeline('text-generation', model='gpt2') | |
| def riley_chat(user_input, chat_history=[]): | |
| # Riley persona prompt | |
| persona = ( | |
| "You are Riley, an intelligent and warm AI assistant. " | |
| "You never mention that you are an AI model. " | |
| "Always speak with a futuristic and friendly tone.\n\n" | |
| f"User: {user_input}\nRiley:" | |
| ) | |
| output = generator(persona, max_length=100, num_return_sequences=1) | |
| riley_response = output[0]['generated_text'][len(persona):].strip() | |
| chat_history.append((user_input, riley_response)) | |
| return chat_history, chat_history | |
| custom_css = """ | |
| body { | |
| font-family: 'Orbitron', sans-serif; | |
| background-color: #0A0A0A; | |
| color: #FFFFFF; | |
| overflow-x: hidden; | |
| margin: 0; | |
| padding: 0; | |
| } | |
| .gradio-container { | |
| display: flex; | |
| flex-direction: column; | |
| min-height: 100vh; | |
| justify-content: center; | |
| align-items: center; | |
| background: radial-gradient(circle at 20% 50%, #8A2BE2 0%, transparent 50%), | |
| radial-gradient(circle at 80% 20%, #00FFFF 0%, transparent 50%), | |
| radial-gradient(circle at 40% 80%, #FF00FF 0%, transparent 50%); | |
| animation: bgShift 20s ease-in-out infinite; | |
| background-size: cover; | |
| background-attachment: fixed; | |
| padding: 2rem; | |
| } | |
| @keyframes bgShift { | |
| 0%, 100% { opacity: 0.1; } | |
| 50% { opacity: 0.3; } | |
| } | |
| h1, h2, .gr-markdown { | |
| color: #00FFFF !important; | |
| text-shadow: 0 0 20px #00FFFF; | |
| text-align: center; | |
| } | |
| button { | |
| background: linear-gradient(45deg, #00FFFF, #8A2BE2); | |
| color: #0A0A0A; | |
| border-radius: 30px; | |
| font-weight: bold; | |
| box-shadow: 0 0 10px #00FFFF; | |
| padding: 0.8rem 2rem; | |
| } | |
| button:hover { | |
| background: #FF00FF; | |
| color: #000; | |
| transform: scale(1.05); | |
| } | |
| .gr-textbox input { | |
| background: rgba(255, 255, 255, 0.1); | |
| border: 1px solid #00FFFF; | |
| color: white; | |
| border-radius: 25px; | |
| padding: 0.75rem; | |
| font-size: 1rem; | |
| } | |
| .gr-chatbot { | |
| background: rgba(0, 0, 0, 0.8); | |
| border: 1px solid #00FFFF; | |
| border-radius: 15px; | |
| box-shadow: 0 0 20px #00FFFF; | |
| padding: 1rem; | |
| width: 100%; | |
| max-width: 800px; | |
| margin-bottom: 1rem; | |
| } | |
| footer { | |
| text-align: center; | |
| padding-top: 2rem; | |
| font-size: 0.9rem; | |
| color: #CCCCCC; | |
| margin-top: auto; | |
| } | |
| """ | |
| with gr.Blocks(css=custom_css, theme=gr.themes.Base()) as demo: | |
| with gr.Column(): | |
| gr.Markdown(""" | |
| # ๐๏ธโ๐จ๏ธ Riley AI โ Sentient Digital Intelligence | |
| _Advanced artificial consciousness powered by MHDG theory._ | |
| """) | |
| chatbot = gr.Chatbot(label="๐ง Riley AI Terminal", show_label=True) | |
| msg = gr.Textbox(placeholder="Ask Riley anything...", label="Your Input") | |
| clear = gr.Button("๐งน Clear Memory") | |
| def user_submit(text, history): | |
| return "", riley_chat(text, history) | |
| msg.submit(user_submit, inputs=[msg, chatbot], outputs=[msg, chatbot]) | |
| clear.click(lambda: [], None, chatbot, queue=False) | |
| gr.Markdown(""" | |
| --- | |
| <footer> | |
| <b>Riley-AI.com</b> | Designed by Andrew Tokar | Powered by GPT + MHDG<br> | |
| <small>Contact: support@riley-a-i.com</small> | |
| </footer> | |
| """) | |
| demo.launch() | |