Answer the question
In order to leave comments, you need to log in
How to get the image url?
So guys, look, there is a request for the Google API service, and one of the parameters of the silk is for the picture, the picture is locally on my computer, so you need to somehow upload the picture (programmatically) to some kind of hosting (you can take a few seconds to send a request ) to get a snare on the picture. Preferably a Python example. Who can write a service on which to throw a photo. Thanks in advance to everyone for help!
My request:
import requests
url = "https://vision.googleapis.com/v1/images:annotate"
params = {"key": "Your key"}
imageUrl = "URL of some photo" # example https://i.vimeocdn.com/video/766293448_1920x1080?r=pad
payload = {"imageUri": imageUrl}
res = requests.post(url, params = params, json = payload)
print(res.json())
Answer the question
In order to leave comments, you need to log in
https://api.imgbb.com/
import base64
import requests
with open("fig1.png", "rb") as file:
url = "https://api.imgbb.com/1/upload"
# key_imgbb - это твой api ключ, получаешь его зарегавшись на сервисе
payload = {
"key": key_imgbb,
"image": base64.b64encode(file.read()),
}
res = requests.post(url, payload)
print(res.json()) # забираешь отсюда нужную тебе ссылку на файл, и отправляешь в google
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question