Upload and download files with the API.
Automatic upload
Local file paths are uploaded automatically:
python
1result = client.run({2 "app": "image-processor",3 "input": {4 "image": "/path/to/image.png" # Uploaded for you5 }6})Manual upload
python
1file = client.upload_file("/path/to/file.png")2print(file["uri"]) # inf-files://...3 4result = client.run({5 "app": "image-processor",6 "input": {"image": file["uri"]}7})JavaScript
javascript
1// Node.js2const file = await client.uploadFile('/path/to/file.png');3 4// Browser5const file = await client.uploadFile(fileBlob);Downloading results
Output files come as URIs:
python
1result = client.run(params)2output_url = result["output"]["image"]["uri"]3 4import requests5response = requests.get(output_url)6with open("output.png", "wb") as f:7 f.write(response.content)File types
Files in inputs/outputs use the File type:
python
1{2 "uri": "https://...", # Download URL3 "path": "/tmp/file.png" # Local path (in worker)4}