File size: 710 Bytes
03707a9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
172b5fe
 
03707a9
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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()