You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.0 KiB
41 lines
1.0 KiB
import time
|
|
from eden.client import Client
|
|
from eden.datatypes import Image
|
|
|
|
## set up a client
|
|
c = Client(url="http://0.0.0.0:5656", username="abraham")
|
|
|
|
# get server's identity
|
|
generator_id = c.get_generator_identity()
|
|
print(generator_id)
|
|
|
|
## define input args to be sent
|
|
config = {
|
|
"width": 2000, ## width
|
|
"height": 1000, ## height
|
|
"input_image": Image(
|
|
"/home/mm/Downloads/FF06F0EC-1B54-458A-BF12-FF7FC2A43C10.jpeg"
|
|
), ## images require eden.datatypes.Image()
|
|
}
|
|
|
|
# start the task
|
|
run_response = c.run(config)
|
|
|
|
print("Intitial response")
|
|
# check status of the task, returns the output too if the task is complete
|
|
results = c.fetch(token=run_response["token"])
|
|
print(results)
|
|
|
|
# one eternity later
|
|
# time.sleep(5)
|
|
|
|
print("Trying")
|
|
while results["status"].get("status") != "complete":
|
|
results = c.fetch(token=run_response["token"])
|
|
print(results)
|
|
time.sleep(0.1)
|
|
|
|
## check status again, hopefully the task is complete by now
|
|
# results = c.fetch(token=run_response["token"])
|
|
# print(results)
|
|
# results['output']['image'].show()
|