ariG23498 HF Staff commited on
Commit
3d6e640
·
verified ·
1 Parent(s): 29c167a

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

Browse files
Files changed (1) hide show
  1. black-forest-labs_FLUX.1-dev_3.py +24 -2
black-forest-labs_FLUX.1-dev_3.py CHANGED
@@ -12,7 +12,18 @@
12
 
13
  try:
14
  import os
15
- os.environ['HF_TOKEN'] = 'YOUR_TOKEN_HERE'
 
 
 
 
 
 
 
 
 
 
 
16
  with open('black-forest-labs_FLUX.1-dev_3.txt', 'w', encoding='utf-8') as f:
17
  f.write('Everything was good in black-forest-labs_FLUX.1-dev_3.txt')
18
  except Exception as e:
@@ -28,7 +39,18 @@ except Exception as e:
28
  import traceback
29
  f.write('''```CODE:
30
  import os
31
- os.environ['HF_TOKEN'] = 'YOUR_TOKEN_HERE'
 
 
 
 
 
 
 
 
 
 
 
32
  ```
33
 
34
  ERROR:
 
12
 
13
  try:
14
  import os
15
+ from huggingface_hub import InferenceClient
16
+
17
+ client = InferenceClient(
18
+ provider="auto",
19
+ api_key=os.environ["HF_TOKEN"],
20
+ )
21
+
22
+ # output is a PIL.Image object
23
+ image = client.text_to_image(
24
+ "Astronaut riding a horse",
25
+ model="black-forest-labs/FLUX.1-dev",
26
+ )
27
  with open('black-forest-labs_FLUX.1-dev_3.txt', 'w', encoding='utf-8') as f:
28
  f.write('Everything was good in black-forest-labs_FLUX.1-dev_3.txt')
29
  except Exception as e:
 
39
  import traceback
40
  f.write('''```CODE:
41
  import os
42
+ from huggingface_hub import InferenceClient
43
+
44
+ client = InferenceClient(
45
+ provider="auto",
46
+ api_key=os.environ["HF_TOKEN"],
47
+ )
48
+
49
+ # output is a PIL.Image object
50
+ image = client.text_to_image(
51
+ "Astronaut riding a horse",
52
+ model="black-forest-labs/FLUX.1-dev",
53
+ )
54
  ```
55
 
56
  ERROR: