ariG23498 HF Staff commited on
Commit
a918d0d
·
verified ·
1 Parent(s): 3b10927

Upload lightx2v_Qwen-Image-Lightning_1.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. lightx2v_Qwen-Image-Lightning_1.py +53 -0
lightx2v_Qwen-Image-Lightning_1.py ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # /// script
2
+ # requires-python = ">=3.12"
3
+ # dependencies = [
4
+ # "torch",
5
+ # "torchvision",
6
+ # "transformers",
7
+ # "accelerate",
8
+ # "peft",
9
+ # "slack-sdk",
10
+ # ]
11
+ # ///
12
+
13
+ try:
14
+ from diffusers import DiffusionPipeline
15
+
16
+ pipe = DiffusionPipeline.from_pretrained("lightx2v/Qwen-Image-Lightning")
17
+
18
+ prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"
19
+ image = pipe(prompt).images[0]
20
+ with open('lightx2v_Qwen-Image-Lightning_1.txt', 'w', encoding='utf-8') as f:
21
+ f.write('Everything was good in lightx2v_Qwen-Image-Lightning_1.txt')
22
+ except Exception as e:
23
+ import os
24
+ from slack_sdk import WebClient
25
+ client = WebClient(token=os.environ['SLACK_TOKEN'])
26
+ client.chat_postMessage(
27
+ channel='#exp-slack-alerts',
28
+ text='Problem in <https://huggingface.co/datasets/model-metadata/code_execution_files/blob/main/lightx2v_Qwen-Image-Lightning_1.txt|lightx2v_Qwen-Image-Lightning_1.txt>',
29
+ )
30
+
31
+ with open('lightx2v_Qwen-Image-Lightning_1.txt', 'a', encoding='utf-8') as f:
32
+ import traceback
33
+ f.write('''```CODE:
34
+ from diffusers import DiffusionPipeline
35
+
36
+ pipe = DiffusionPipeline.from_pretrained("lightx2v/Qwen-Image-Lightning")
37
+
38
+ prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"
39
+ image = pipe(prompt).images[0]
40
+ ```
41
+
42
+ ERROR:
43
+ ''')
44
+ traceback.print_exc(file=f)
45
+
46
+ finally:
47
+ from huggingface_hub import upload_file
48
+ upload_file(
49
+ path_or_fileobj='lightx2v_Qwen-Image-Lightning_1.txt',
50
+ repo_id='model-metadata/code_execution_files',
51
+ path_in_repo='lightx2v_Qwen-Image-Lightning_1.txt',
52
+ repo_type='dataset',
53
+ )