Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix stable diffusion app #576

Merged
merged 2 commits into from
Feb 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions 06_gpu_and_ml/stable_diffusion/stable_diffusion_xl.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@


sdxl_image = (
Image.debian_slim()
Image.debian_slim(python_version="3.10")
.apt_install(
"libglib2.0-0", "libsm6", "libxrender1", "libxext6", "ffmpeg", "libgl1"
)
Expand All @@ -46,11 +46,8 @@
stub = Stub("stable-diffusion-xl")

with sdxl_image.imports():
import fastapi.staticfiles
import torch
from diffusers import DiffusionPipeline
from fastapi import FastAPI
from fastapi.responses import Response
from huggingface_hub import snapshot_download

# ## Load model and run inference
Expand Down Expand Up @@ -167,6 +164,10 @@ def main(prompt: str):
)
@asgi_app()
def app():
import fastapi.staticfiles
from fastapi import FastAPI
from fastapi.responses import Response

web_app = FastAPI()

@web_app.get("/infer/{prompt}")
Expand Down
Loading