ariG23498 HF Staff commited on
Commit
2e41a15
·
verified ·
1 Parent(s): f6feed8

Upload tlennon-ie_qwen-edit-skin_0.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. tlennon-ie_qwen-edit-skin_0.py +57 -0
tlennon-ie_qwen-edit-skin_0.py ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # /// script
2
+ # requires-python = ">=3.12"
3
+ # dependencies = [
4
+ # "torch",
5
+ # "torchvision",
6
+ # "transformers",
7
+ # "diffusers",
8
+ # "sentence-transformers",
9
+ # "accelerate",
10
+ # "peft",
11
+ # "slack-sdk",
12
+ # ]
13
+ # ///
14
+
15
+ try:
16
+ from diffusers import DiffusionPipeline
17
+
18
+ pipe = DiffusionPipeline.from_pretrained("Qwen/Qwen-Image-Edit-2509")
19
+ pipe.load_lora_weights("tlennon-ie/qwen-edit-skin")
20
+
21
+ prompt = "make the subjects skin details more prominent and natural"
22
+ image = pipe(prompt).images[0]
23
+ with open('tlennon-ie_qwen-edit-skin_0.txt', 'w', encoding='utf-8') as f:
24
+ f.write('Everything was good in tlennon-ie_qwen-edit-skin_0.txt')
25
+ except Exception as e:
26
+ import os
27
+ from slack_sdk import WebClient
28
+ client = WebClient(token=os.environ['SLACK_TOKEN'])
29
+ client.chat_postMessage(
30
+ channel='#hub-model-metadata-snippets-sprint',
31
+ text='Problem in <https://huggingface.co/datasets/model-metadata/code_execution_files/blob/main/tlennon-ie_qwen-edit-skin_0.txt|tlennon-ie_qwen-edit-skin_0.txt>',
32
+ )
33
+
34
+ with open('tlennon-ie_qwen-edit-skin_0.txt', 'a', encoding='utf-8') as f:
35
+ import traceback
36
+ f.write('''```CODE:
37
+ from diffusers import DiffusionPipeline
38
+
39
+ pipe = DiffusionPipeline.from_pretrained("Qwen/Qwen-Image-Edit-2509")
40
+ pipe.load_lora_weights("tlennon-ie/qwen-edit-skin")
41
+
42
+ prompt = "make the subjects skin details more prominent and natural"
43
+ image = pipe(prompt).images[0]
44
+ ```
45
+
46
+ ERROR:
47
+ ''')
48
+ traceback.print_exc(file=f)
49
+
50
+ finally:
51
+ from huggingface_hub import upload_file
52
+ upload_file(
53
+ path_or_fileobj='tlennon-ie_qwen-edit-skin_0.txt',
54
+ repo_id='model-metadata/code_execution_files',
55
+ path_in_repo='tlennon-ie_qwen-edit-skin_0.txt',
56
+ repo_type='dataset',
57
+ )