0

I have a full stable diffusion image to image model working on Colab, powered by Gradio. However, it requries nvidia gpu. When I deploy it to hugging face spaces, a runtime error occurs:

RuntimeError: Found no NVIDIA driver on your system. Please check that you have an NVIDIA GPU and installed a driver from http://www.nvidia.com/Download/index.aspx

How do i deploy the model? Is there some other way to deploy the model, like some resources for deploying on AWS, Azure, for free.

Here's the main code of the model:

def predict(img, strength, seed, prompt):
  seed =  int(seed)
  img1 = np.asarray(img)
  img2 = Image.fromarray(img1)

  init_image = img2.resize((768, 512))

  
  generator = torch.Generator(device=device).manual_seed(seed)
  with autocast("cuda"):
    image = pipe(prompt=prompt, init_image=init_image, strength=strength, guidance_scale=5, generator=generator).images[0]

  return image


gr.Interface(
    predict,
    title = 'Image to Image using Diffusers',
    inputs=[
        gr.Image(),
        gr.Slider(0, 1, value=0.05, label ="strength (keep it close to 0 to make minimal changes to image (such as 0.1, 0.2, 0.3)"),
        gr.Number(label = "seed (any number, generally 1024. But it's totally random. Change it and see different outputs)"),
        gr.Textbox(label="Prompt, empty by default")
    ],
    outputs = [
        gr.Image()
        ]
).launch()

0 Answers0