Spaces:
Runtime error
Runtime error
Commit
·
6d87ed3
1
Parent(s):
5366747
Changes
Browse files
app.py
CHANGED
@@ -14,13 +14,10 @@ from huggingface_hub import login
|
|
14 |
login(token='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')
|
15 |
|
16 |
|
17 |
-
# model_path = WEIGHTS_DIR # If you want to use previously trained model saved in gdrive, replace this with the full path of model in gdrive
|
18 |
-
# headers = {"Authorization": "Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}
|
19 |
-
|
20 |
pipe = StableDiffusionPipeline.from_pretrained("Divyanshu04/Finetuned-model", safety_checker=None, torch_dtype=torch.float32).to("cpu")
|
21 |
|
22 |
pipe.scheduler = DDIMScheduler.from_config(pipe.scheduler.config)
|
23 |
-
# pipe.enable_xformers_memory_efficient_attention()
|
24 |
g_cuda = None
|
25 |
|
26 |
FILE = Path(__file__).resolve()
|
@@ -53,7 +50,6 @@ def generate():
|
|
53 |
seed = 52362
|
54 |
g_cuda.manual_seed(seed)
|
55 |
|
56 |
-
# commandline_args = os.environ.get('COMMANDLINE_ARGS', "--skip-torch-cuda-test --no-half")
|
57 |
|
58 |
with autocast("cpu"), torch.inference_mode():
|
59 |
images = pipe(
|
@@ -67,7 +63,7 @@ def generate():
|
|
67 |
generator=g_cuda
|
68 |
).images
|
69 |
|
70 |
-
|
71 |
|
72 |
else:
|
73 |
st.write('<Enter parameters to generate image>')
|
|
|
14 |
login(token='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')
|
15 |
|
16 |
|
|
|
|
|
|
|
17 |
pipe = StableDiffusionPipeline.from_pretrained("Divyanshu04/Finetuned-model", safety_checker=None, torch_dtype=torch.float32).to("cpu")
|
18 |
|
19 |
pipe.scheduler = DDIMScheduler.from_config(pipe.scheduler.config)
|
20 |
+
# pipe.enable_xformers_memory_efficient_attention() #if gpu is available
|
21 |
g_cuda = None
|
22 |
|
23 |
FILE = Path(__file__).resolve()
|
|
|
50 |
seed = 52362
|
51 |
g_cuda.manual_seed(seed)
|
52 |
|
|
|
53 |
|
54 |
with autocast("cpu"), torch.inference_mode():
|
55 |
images = pipe(
|
|
|
63 |
generator=g_cuda
|
64 |
).images
|
65 |
|
66 |
+
st.image(images)
|
67 |
|
68 |
else:
|
69 |
st.write('<Enter parameters to generate image>')
|