Upload DFloat11_Qwen-Image-DF11_0.py with huggingface_hub
Browse files
DFloat11_Qwen-Image-DF11_0.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("DFloat11/Qwen-Image-DF11")
|
| 18 |
+
|
| 19 |
+
prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"
|
| 20 |
+
image = pipe(prompt).images[0]
|
| 21 |
+
with open('DFloat11_Qwen-Image-DF11_0.txt', 'w') as f:
|
| 22 |
+
f.write('Everything was good in DFloat11_Qwen-Image-DF11_0.txt')
|
| 23 |
+
except Exception as e:
|
| 24 |
+
with open('DFloat11_Qwen-Image-DF11_0.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='DFloat11_Qwen-Image-DF11_0.txt',
|
| 31 |
+
repo_id='model-metadata/custom_code_execution_files',
|
| 32 |
+
path_in_repo='DFloat11_Qwen-Image-DF11_0.txt',
|
| 33 |
+
repo_type='dataset',
|
| 34 |
+
)
|