Call api of space to run in my website

#42
by hanguyen146 - opened

hello, i want to call api from a space to run in my website but it give me error
image.png
can any one help me, thankyou

hanguyen146 changed discussion title from Call api of space to run my website to Call api of space to run in my website

This example worked for me

from gradio_client import Client, file

client = Client("felixrosberg/face-swap")
result = client.predict(
        target=file('https://upload.wikimedia.org/wikipedia/commons/thumb/8/8d/President_Barack_Obama.jpg/1280px-President_Barack_Obama.jpg'),
        source=file('https://upload.wikimedia.org/wikipedia/commons/9/99/Elon_Musk_Colorado_2022_%28cropped2%29.jpg'),
        slider=100,
        adv_slider=100,
        settings=["Adversarial Defense"],
        api_name="/run_inference"
)
print(result)

Sign up or log in to comment