ariG23498 HF Staff commited on
Commit
965df66
·
verified ·
1 Parent(s): 0cd6638

Upload stabilityai_stable-diffusion-3.5-large_1.py with huggingface_hub

Browse files
stabilityai_stable-diffusion-3.5-large_1.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # /// script
2
+ # requires-python = ">=3.12"
3
+ # dependencies = [
4
+ # "numpy",
5
+ # "einops",
6
+ # "torch",
7
+ # "transformers",
8
+ # "datasets",
9
+ # "accelerate",
10
+ # "timm",
11
+ # ]
12
+ # ///
13
+
14
+ try:
15
+ from diffusers import DiffusionPipeline
16
+
17
+ pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-3.5-large")
18
+
19
+ prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"
20
+ image = pipe(prompt).images[0]
21
+ with open('stabilityai_stable-diffusion-3.5-large_1.txt', 'w') as f:
22
+ f.write('Everything was good in stabilityai_stable-diffusion-3.5-large_1.txt')
23
+ except Exception as e:
24
+ with open('stabilityai_stable-diffusion-3.5-large_1.txt', 'w') as f:
25
+ import traceback
26
+ traceback.print_exc(file=f)
27
+ finally:
28
+ from huggingface_hub import upload_file
29
+ upload_file(
30
+ path_or_fileobj='stabilityai_stable-diffusion-3.5-large_1.txt',
31
+ repo_id='model-metadata/custom_code_execution_files',
32
+ path_in_repo='stabilityai_stable-diffusion-3.5-large_1.txt',
33
+ repo_type='dataset',
34
+ )