import gradio as gr import requests # Replace with your actual API endpoint (if using a different service) API_URL = "https://api.deepseek.com/v1/chat/completions" # Example (not me) API_KEY = "your-api-key" # Replace with your key def ask_ruby(question): headers = { "Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json" } data = { "messages": [{"role": "user", "content": question}] } response = requests.post(API_URL, headers=headers, json=data) return response.json()["choices"][0]["message"]["content"] # Gradio UI (optional, but useful for testing) demo = gr.Interface( fn=ask_ruby, inputs=gr.Textbox(lines=2, placeholder="Ask Ruby anything..."), outputs="text", title="Ruby AI API" ) demo.launch()