Created
January 24, 2022 09:47
-
-
Save JohannSuarez/53799429af32c1e0bcfd3daff16f8f26 to your computer and use it in GitHub Desktop.
Post Image to FastAPI endpoint
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
file_name: str = "hope_sandoval.jpg" | |
headers = { | |
'accept': 'application/json', | |
'Content-Type': 'multipart/form-data', | |
} | |
file = { | |
'image': (file_name, open(file_name, 'rb'), 'image/jpg') | |
} | |
response = requests.post('http://127.0.0.1:8000/image', files=file) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment