Error Error: No API found

Hi,

I was working with a CPU Upgrade space and everything was running perfectly. After upgrading to PRO, I switched the space to zero GPU, and it stopped working. Now I’m getting the following error:

Error: No API found.

Could you please help me resolve this?

Thanks in advance!

1 Like

In Zero GPU space, the space will not function without these descriptions.

import spaces # <= this!
from diffusers import DiffusionPipeline

pipe = DiffusionPipeline.from_pretrained(...)
pipe.to('cuda')

@spaces.GPU # <= this!
def generate(prompt):
    return pipe(prompt).images

gr.Interface(
    fn=generate,
    inputs=gr.Text(),
    outputs=gr.Gallery(),
).launch()

Also, this is not limited to Zero GPU space, but the following error may still be unresolved.