Spaces:
Sleeping
Sleeping
Update README.md
Browse files
README.md
CHANGED
|
@@ -9,4 +9,15 @@ app_file: app.py
|
|
| 9 |
pinned: false
|
| 10 |
---
|
| 11 |
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
pinned: false
|
| 10 |
---
|
| 11 |
|
| 12 |
+
|
| 13 |
+
**1. Receive as a Python Dictionary (JSON Object)**
|
| 14 |
+
Useful if you want to immediately work with the data in Python.
|
| 15 |
+
```python
|
| 16 |
+
import requests; data = requests.post("http://localhost:7860/api/process", json={"code": "def hello(): pass", "format": "json"}, headers={"Authorization": "Bearer hf_YOUR_TOKEN"}).json()
|
| 17 |
+
```
|
| 18 |
+
|
| 19 |
+
**2. Receive as a JSONL String**
|
| 20 |
+
Useful if you are appending directly to a file or stream.
|
| 21 |
+
```python
|
| 22 |
+
import requests; jsonl_string = requests.post("http://localhost:7860/api/process", json={"code": "def hello(): pass", "format": "jsonl"}, headers={"Authorization": "Bearer hf_YOUR_TOKEN"}).text
|
| 23 |
+
```
|