Spaces:
Running
on
Zero
Running
on
Zero
add release GPU decoration for generate fn
Browse files- app.py +2 -0
- requirements.txt +1 -4
app.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
from fastapi import FastAPI, HTTPException, UploadFile, File
|
2 |
from typing import Optional, Dict, Any
|
3 |
import torch
|
@@ -338,6 +339,7 @@ def create_gradio_interface():
|
|
338 |
)
|
339 |
]
|
340 |
|
|
|
341 |
def generate(model_name, prompt_text, h, w, steps, guide_scale, ref_img):
|
342 |
response = generate_image(
|
343 |
model_name=model_name,
|
|
|
1 |
+
import spaces
|
2 |
from fastapi import FastAPI, HTTPException, UploadFile, File
|
3 |
from typing import Optional, Dict, Any
|
4 |
import torch
|
|
|
339 |
)
|
340 |
]
|
341 |
|
342 |
+
@spaces.GPU
|
343 |
def generate(model_name, prompt_text, h, w, steps, guide_scale, ref_img):
|
344 |
response = generate_image(
|
345 |
model_name=model_name,
|
requirements.txt
CHANGED
@@ -26,13 +26,10 @@
|
|
26 |
--extra-index-url https://download.pytorch.org/whl/cu113
|
27 |
fastapi==0.95.2
|
28 |
uvicorn==0.22.0
|
29 |
-
|
30 |
-
torchvision==0.13.1+cu113
|
31 |
-
torchaudio==0.12.1+cu113
|
32 |
diffusers
|
33 |
transformers==4.26.1
|
34 |
Pillow==9.4.0
|
35 |
numpy==1.23.5
|
36 |
gradio==3.16.2
|
37 |
huggingface_hub
|
38 |
-
torch
|
|
|
26 |
--extra-index-url https://download.pytorch.org/whl/cu113
|
27 |
fastapi==0.95.2
|
28 |
uvicorn==0.22.0
|
|
|
|
|
|
|
29 |
diffusers
|
30 |
transformers==4.26.1
|
31 |
Pillow==9.4.0
|
32 |
numpy==1.23.5
|
33 |
gradio==3.16.2
|
34 |
huggingface_hub
|
35 |
+
torch==2.4.0
|