nanodk12 commited on
Commit
053834c
·
verified ·
1 Parent(s): fde4ccc
Files changed (1) hide show
  1. app.py +26 -0
app.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import requests
3
+
4
+ # Replace with your actual API endpoint (if using a different service)
5
+ API_URL = "https://api.deepseek.com/v1/chat/completions" # Example (not me)
6
+ API_KEY = "your-api-key" # Replace with your key
7
+
8
+ def ask_ruby(question):
9
+ headers = {
10
+ "Authorization": f"Bearer {API_KEY}",
11
+ "Content-Type": "application/json"
12
+ }
13
+ data = {
14
+ "messages": [{"role": "user", "content": question}]
15
+ }
16
+ response = requests.post(API_URL, headers=headers, json=data)
17
+ return response.json()["choices"][0]["message"]["content"]
18
+
19
+ # Gradio UI (optional, but useful for testing)
20
+ demo = gr.Interface(
21
+ fn=ask_ruby,
22
+ inputs=gr.Textbox(lines=2, placeholder="Ask Ruby anything..."),
23
+ outputs="text",
24
+ title="Ruby AI API"
25
+ )
26
+ demo.launch()