MaduRox commited on
Commit
25c3ffa
·
1 Parent(s): e907010

docs: add cURL equivalent and rename Swagger tab

Browse files
Files changed (1) hide show
  1. app.py +20 -6
app.py CHANGED
@@ -298,16 +298,30 @@ with gr.Blocks(title="Kalpanā API — ZeroGPU NVIDIA A100", theme=gr.themes.Sof
298
  api_name="benchmark_phase_attention"
299
  )
300
 
301
- with gr.TabItem("📖 Swagger & REST API Reference"):
302
  gr.Markdown(
303
  """
304
  ### 🌐 Public REST API Specification
305
 
306
- You can query this Kalpanā RIF Neural Engine programmatically from **PowerShell, Python, JavaScript, or cURL**.
307
 
308
  ---
309
 
310
- #### 🪟 1. Windows PowerShell (Single-Command 2-Step Execution)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
311
  ```powershell
312
  # Step 1 & 2: Submit prompt and stream the generated response
313
  $res = Invoke-RestMethod -Uri "https://madurox-kalpana-api-gpu.hf.space/gradio_api/call/generate" -Method Post -ContentType "application/json" -Body '{"data": ["What is cricket?", 128, 0.7]}'
@@ -316,7 +330,7 @@ Invoke-RestMethod -Uri "https://madurox-kalpana-api-gpu.hf.space/gradio_api/call
316
 
317
  ---
318
 
319
- #### 🐍 2. Python (`requests` - 2-Step REST Stream)
320
  ```python
321
  import requests, json
322
 
@@ -336,7 +350,7 @@ for line in sse_res.text.split("\\n"):
336
 
337
  ---
338
 
339
- #### 🐍 3. Python (`gradio_client`)
340
  ```python
341
  from gradio_client import Client
342
 
@@ -355,7 +369,7 @@ print("Telemetry:", latency, memory, layers)
355
 
356
  ---
357
 
358
- #### 🌐 4. JavaScript / Web (`fetch` & SSE)
359
  ```javascript
360
  // Step 1: POST prompt
361
  const postRes = await fetch("https://madurox-kalpana-api-gpu.hf.space/gradio_api/call/generate", {
 
298
  api_name="benchmark_phase_attention"
299
  )
300
 
301
+ with gr.TabItem("📖 REST API Reference"):
302
  gr.Markdown(
303
  """
304
  ### 🌐 Public REST API Specification
305
 
306
+ You can query this Kalpanā RIF Neural Engine programmatically from **cURL, PowerShell, Python, or JavaScript**.
307
 
308
  ---
309
 
310
+ #### 💻 1. Linux/Mac Terminal (cURL - 2-Step REST Stream)
311
+ ```bash
312
+ # Step 1: Submit prompt to /call/generate to get an event_id
313
+ curl -X POST "https://madurox-kalpana-api-gpu.hf.space/gradio_api/call/generate" \
314
+ -H "Content-Type: application/json" \
315
+ -d '{"data": ["What is cricket?", 128, 0.7]}'
316
+
317
+ # Step 2: Use the returned event_id to stream the output
318
+ # (Replace EVENT_ID with the actual id returned from step 1)
319
+ curl -X GET "https://madurox-kalpana-api-gpu.hf.space/gradio_api/call/generate/EVENT_ID"
320
+ ```
321
+
322
+ ---
323
+
324
+ #### 🪟 2. Windows PowerShell (Single-Command 2-Step Execution)
325
  ```powershell
326
  # Step 1 & 2: Submit prompt and stream the generated response
327
  $res = Invoke-RestMethod -Uri "https://madurox-kalpana-api-gpu.hf.space/gradio_api/call/generate" -Method Post -ContentType "application/json" -Body '{"data": ["What is cricket?", 128, 0.7]}'
 
330
 
331
  ---
332
 
333
+ #### 🐍 3. Python (`requests` - 2-Step REST Stream)
334
  ```python
335
  import requests, json
336
 
 
350
 
351
  ---
352
 
353
+ #### 🐍 4. Python (`gradio_client`)
354
  ```python
355
  from gradio_client import Client
356
 
 
369
 
370
  ---
371
 
372
+ #### 🌐 5. JavaScript / Web (`fetch` & SSE)
373
  ```javascript
374
  // Step 1: POST prompt
375
  const postRes = await fetch("https://madurox-kalpana-api-gpu.hf.space/gradio_api/call/generate", {