File size: 2,784 Bytes
4958545
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e62fa69
 
 
4958545
 
e62fa69
4958545
 
e62fa69
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4958545
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# Using Gradio API with curl.exe on Windows

This guide explains how to interact with any Gradio app as an API using `curl.exe` from Windows PowerShell. It covers both public Hugging Face Spaces and local Gradio apps.

## Prerequisites
- Windows with PowerShell
- `curl.exe` (included in Windows 10+)
- The URL of your Gradio app (public or local, e.g., http://127.0.0.1:7860/)

## Step 1: Prepare Your Input
Create a file named `payload.json` in your working directory. For a local MCP Gradio app, the payload might look like:

```json
{
  "data": [
    "https://mcp.composio.dev/composio/server/ca1477ae-dffb-404c-9021-ef25ff440221/mcp",
    "SALESFORCE_RETRIEVE_LEAD_BY_ID",
    "{\"id\": \"00QgK0000005yjVUAQ\"}"
  ]
}
```

## Step 2: Make the POST Request (Local Gradio)
Send your input to the local Gradio API endpoint using this command:

```powershell
curl.exe -X POST http://127.0.0.1:7860/gradio_api/call/predict -s -H "Content-Type: application/json" -d '@payload.json'
```

This returns a JSON response with an `event_id`, e.g.:

```json
{"event_id":"YOUR_EVENT_ID"}
```

## Step 3: Fetch the Result (Local Gradio)
Use the `event_id` from the previous step to fetch the result:

```powershell
curl.exe -N http://127.0.0.1:7860/gradio_api/call/predict/YOUR_EVENT_ID
```

You will see output like:

```
event: complete
data: [ ... ]
```


## Example for Public Gradio Apps (Production)
For the production Gradio Space, use the following endpoint and adjust the payload as needed:

```powershell
curl.exe -X POST https://boardflare-mcp-client.hf.space/gradio_api/call/predict -s -H "Content-Type: application/json" -d '@payload.json'
```

This returns a JSON response with an `event_id`, e.g.:

```json
{"event_id":"YOUR_EVENT_ID"}
```

Then fetch the result with:

```powershell
curl.exe -N https://boardflare-mcp-client.hf.space/gradio_api/call/predict/YOUR_EVENT_ID
```

You will see output like:

```
event: complete
data: [ ... ]
```

## Notes
- For Gradio apps with multiple inputs, adjust the `data` array in `payload.json` accordingly.
- For private Spaces, add your Hugging Face token with `-H "Authorization: Bearer YOUR_TOKEN"` to both requests.
- For file inputs, use a dictionary with a `path` key pointing to a file URL.
- If authentication is required, first POST to `/login` and use the returned cookies in subsequent requests.

## Troubleshooting
- Always use single quotes around `@payload.json` in PowerShell to avoid variable expansion errors.
- If you get JSON errors, check your `payload.json` formatting.
- If you get a 404 or "Not Found" error, check the endpoint path (e.g., `/gradio_api/call/predict` for local apps).

---

This guide is based on the official Gradio documentation and adapted for both public and local Windows PowerShell use cases.