import requests import random import time def get_r_HF(): res = requests.post("https://huseyng-ecs7022p-wgan-gp.hf.space/run/predict", json={ "data": []}).json() data = res["data"] b64 = data[0].split(',')[0] print(b64) return b64 def schedule_function(): # for dummy space so that this spcae and other space will call each other to avoid sleep time, again this project is for academic purpose. while True: wait_time = random.uniform(3 * 60 * 60, 5 * 60 * 60) # Get a random wait time between 3 and 5 hours in seconds # wait_time = random.uniform(3, 5) time.sleep(wait_time) # call dummyscape get_r_HF() if __name__ == "__main__": schedule_function()