Код Streamlit для загрузки
Код: Выделить всё
if uploaded_file is not None:
fname = uploaded_file.name
img = Image.open(uploaded_file) # Open image in PIL
col1.image(img) #Display the Imgage on ST
img.save(b, 'jpeg') #Send image to the io module
img = b.getvalue() #Convert to bytes
res = self.request(img)
Код: Выделить всё
class response():
def crackD(f):
body = {'deviceSize':('', '(0.0, 0.0, 375.0, 667.0)') ,'ConsumerID':('', '-100'), 'client':'crackd-api', 'metadata':('', '{"source": "streamlit_test"}'), 'file': f} #Body of the post
headers = {"Postman-Token":"xxx","cache-control":"no-cache","x-access-token":"xxx" }
response = requests.post(xxx, headers = headers, files=body)
return response
Подробнее здесь: https://stackoverflow.com/questions/758 ... gh-postman
Мобильная версия