Summary
I dont know why I am getting a axios error when I am uploading image in the streamlit app (http://3.145.64.26:8503/) through my computer
when I am choosing from the preloaded images its working fine but then when I am uploading then its creating problem.
Steps to reproduce
Code snippet:
class JUA():
def __init__(self, image1, url='https://1ei5j2kto9.execute-api.us-east-1.amazonaws.com/prod/predict',
headers={'accept': 'application/json'}):
self.url = url
self.image1 = image1
self.headers = headers
def predict(self):
with open(self.image1, 'rb') as image:
response = requests.post(self.url, headers=self.headers,
files={'file': (self.image1, image, 'image/png')})
if response.status_code == 200:
try:
result = response.json()['prediction']
return result
except JSONDecodeError as e:
print("Error decoding JSON:", e)
print("Response content:", response.content)
else:
print('Failed to call the API, status code:', response.status_code)
print('Response content:', response.content)
If applicable, please provide the steps we should take to reproduce the error or specified behavior.
Expected behavior:
It should authorize the API call but instead its giving axios error
Requirements file
Using Conda? PipEnv? PyEnv? Pex? Share the contents of your requirements file here.
Not sure what a requirements file is? Check out this doc and add a requirements file to your app.
Links
- Link to your GitHub repo:
- Link to your deployed app: http://3.145.64.26:8503/
Additional information
Please anyone help me