ariG23498 HF Staff commited on
Commit
d85594b
·
verified ·
1 Parent(s): ee345d8

Upload black-forest-labs_FLUX.1-dev_1.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. black-forest-labs_FLUX.1-dev_1.py +29 -0
black-forest-labs_FLUX.1-dev_1.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # /// script
2
+ # requires-python = ">=3.12"
3
+ # dependencies = [
4
+ # "transformers",
5
+ # "torch",
6
+ # ]
7
+ # ///
8
+
9
+ try:
10
+ from diffusers import DiffusionPipeline
11
+
12
+ pipe = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-dev")
13
+
14
+ prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"
15
+ image = pipe(prompt).images[0]
16
+ with open('black-forest-labs_FLUX.1-dev_1.txt', 'w') as f:
17
+ f.write('Everything was good in black-forest-labs_FLUX.1-dev_1.txt')
18
+ except Exception as e:
19
+ with open('black-forest-labs_FLUX.1-dev_1.txt', 'w') as f:
20
+ import traceback
21
+ traceback.print_exc(file=f)
22
+ finally:
23
+ from huggingface_hub import upload_file
24
+ upload_file(
25
+ path_or_fileobj='black-forest-labs_FLUX.1-dev_1.txt',
26
+ repo_id='model-metadata/custom_code_execution_files',
27
+ path_in_repo='black-forest-labs_FLUX.1-dev_1.txt',
28
+ repo_type='dataset',
29
+ )