Spaces:
Sleeping
Sleeping
Download app.py from sakethdevx/ai-uncensored: direct link, hf CLI and curl.
- Browser
- Download file 871 Bytes
-
https://huggingface.co/spaces/sakethdevx/ai-uncensored/resolve/main/app.py
- Command line
-
hf download hf://spaces/sakethdevx/ai-uncensored/app.py
-
curl -L -o app.py https://huggingface.co/spaces/sakethdevx/ai-uncensored/resolve/main/app.py
871 Bytes
| import gradio as gr | |
| import requests | |
| # 🔗 Put your Kaggle API URL later | |
| KAGGLE_API_URL = "https://your-kaggle-endpoint.run" | |
| def chat(message, history): | |
| try: | |
| r = requests.post( | |
| KAGGLE_API_URL, | |
| json={"message": message}, | |
| timeout=60 | |
| ) | |
| return r.json()["reply"] | |
| except: | |
| return "⚠️ Backend not running. Start Kaggle session." | |
| with gr.Blocks(title="Free AI Chat") as demo: | |
| gr.Markdown("# 🤖 Free AI Chat (CPU)") | |
| gr.Markdown("Start Kaggle session before chatting.") | |
| chatbot = gr.Chatbot() | |
| msg = gr.Textbox(placeholder="Type your message...") | |
| def respond(message, chat_history): | |
| reply = chat(message, chat_history) | |
| chat_history.append((message, reply)) | |
| return "", chat_history | |
| msg.submit(respond, [msg, chatbot], [msg, chatbot]) | |
| demo.launch() |