| # /// script | |
| # requires-python = ">=3.12" | |
| # dependencies = [ | |
| # "numpy", | |
| # "einops", | |
| # "torch", | |
| # "transformers", | |
| # "datasets", | |
| # "accelerate", | |
| # "timm", | |
| # ] | |
| # /// | |
| try: | |
| from diffusers import DiffusionPipeline | |
| pipe = DiffusionPipeline.from_pretrained("DFloat11/Qwen-Image-DF11") | |
| prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" | |
| image = pipe(prompt).images[0] | |
| with open('DFloat11_Qwen-Image-DF11_0.txt', 'w') as f: | |
| f.write('Everything was good in DFloat11_Qwen-Image-DF11_0.txt') | |
| except Exception as e: | |
| with open('DFloat11_Qwen-Image-DF11_0.txt', 'w') as f: | |
| import traceback | |
| traceback.print_exc(file=f) | |
| finally: | |
| from huggingface_hub import upload_file | |
| upload_file( | |
| path_or_fileobj='DFloat11_Qwen-Image-DF11_0.txt', | |
| repo_id='model-metadata/custom_code_execution_files', | |
| path_in_repo='DFloat11_Qwen-Image-DF11_0.txt', | |
| repo_type='dataset', | |
| ) |