Spaces:
Running
on
Zero
Running
on
Zero
liujie31
commited on
Commit
·
a1f262a
1
Parent(s):
fa4c25e
add space gpy
Browse files- app.py +4 -3
- model_call_counter.txt +0 -1
app.py
CHANGED
@@ -4,7 +4,7 @@ import random
|
|
4 |
from PIL import Image
|
5 |
import os
|
6 |
|
7 |
-
|
8 |
from diffusers import StableDiffusion3Pipeline
|
9 |
import torch
|
10 |
from peft import PeftModel
|
@@ -40,7 +40,8 @@ pipe.transformer.load_adapter(lora_models["Text Rendering"], adapter_name="Text
|
|
40 |
pipe.transformer.load_adapter(lora_models["Human Prefer"], adapter_name="Human Prefer")
|
41 |
pipe = pipe.to(device)
|
42 |
|
43 |
-
COUNTER_FILE = os.path.join(os.getcwd(),"model_call_counter.txt")
|
|
|
44 |
|
45 |
def get_call_count():
|
46 |
if not os.path.exists(COUNTER_FILE):
|
@@ -90,7 +91,7 @@ def create_grid_image(images):
|
|
90 |
|
91 |
return grid_image
|
92 |
|
93 |
-
|
94 |
def infer(
|
95 |
prompt,
|
96 |
seed,
|
|
|
4 |
from PIL import Image
|
5 |
import os
|
6 |
|
7 |
+
import spaces
|
8 |
from diffusers import StableDiffusion3Pipeline
|
9 |
import torch
|
10 |
from peft import PeftModel
|
|
|
40 |
pipe.transformer.load_adapter(lora_models["Human Prefer"], adapter_name="Human Prefer")
|
41 |
pipe = pipe.to(device)
|
42 |
|
43 |
+
# COUNTER_FILE = os.path.join(os.getcwd(),"model_call_counter.txt")
|
44 |
+
COUNTER_FILE = os.path.join("/data/model_call_counter.txt")
|
45 |
|
46 |
def get_call_count():
|
47 |
if not os.path.exists(COUNTER_FILE):
|
|
|
91 |
|
92 |
return grid_image
|
93 |
|
94 |
+
@spaces.GPU
|
95 |
def infer(
|
96 |
prompt,
|
97 |
seed,
|
model_call_counter.txt
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
256
|
|
|
|