Upload Qwen_Qwen-Image-Edit_1.py with huggingface_hub
Browse files- Qwen_Qwen-Image-Edit_1.py +4 -18
    	
        Qwen_Qwen-Image-Edit_1.py
    CHANGED
    
    | @@ -11,15 +11,8 @@ | |
| 11 | 
             
            # ///
         | 
| 12 |  | 
| 13 | 
             
            try:
         | 
| 14 | 
            -
                 | 
| 15 | 
            -
                 | 
| 16 | 
            -
                
         | 
| 17 | 
            -
                pipe = DiffusionPipeline.from_pretrained("Qwen/Qwen-Image-Edit")
         | 
| 18 | 
            -
                
         | 
| 19 | 
            -
                prompt = "Turn this cat into a dog"
         | 
| 20 | 
            -
                input_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png")
         | 
| 21 | 
            -
                
         | 
| 22 | 
            -
                image = pipe(image=input_image, prompt=prompt).images[0]
         | 
| 23 | 
             
                with open('Qwen_Qwen-Image-Edit_1.txt', 'w', encoding='utf-8') as f:
         | 
| 24 | 
             
                    f.write('Everything was good in Qwen_Qwen-Image-Edit_1.txt')
         | 
| 25 | 
             
            except Exception as e:
         | 
| @@ -34,15 +27,8 @@ except Exception as e: | |
| 34 | 
             
                with open('Qwen_Qwen-Image-Edit_1.txt', 'a', encoding='utf-8') as f:
         | 
| 35 | 
             
                    import traceback
         | 
| 36 | 
             
                    f.write('''```CODE: 
         | 
| 37 | 
            -
             | 
| 38 | 
            -
             | 
| 39 | 
            -
             | 
| 40 | 
            -
            pipe = DiffusionPipeline.from_pretrained("Qwen/Qwen-Image-Edit")
         | 
| 41 | 
            -
             | 
| 42 | 
            -
            prompt = "Turn this cat into a dog"
         | 
| 43 | 
            -
            input_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png")
         | 
| 44 | 
            -
             | 
| 45 | 
            -
            image = pipe(image=input_image, prompt=prompt).images[0]
         | 
| 46 | 
             
            ```
         | 
| 47 |  | 
| 48 | 
             
            ERROR: 
         | 
|  | |
| 11 | 
             
            # ///
         | 
| 12 |  | 
| 13 | 
             
            try:
         | 
| 14 | 
            +
                import os
         | 
| 15 | 
            +
                os.environ['HF_TOKEN'] = 'YOUR_TOKEN_HERE'
         | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
| 16 | 
             
                with open('Qwen_Qwen-Image-Edit_1.txt', 'w', encoding='utf-8') as f:
         | 
| 17 | 
             
                    f.write('Everything was good in Qwen_Qwen-Image-Edit_1.txt')
         | 
| 18 | 
             
            except Exception as e:
         | 
|  | |
| 27 | 
             
                with open('Qwen_Qwen-Image-Edit_1.txt', 'a', encoding='utf-8') as f:
         | 
| 28 | 
             
                    import traceback
         | 
| 29 | 
             
                    f.write('''```CODE: 
         | 
| 30 | 
            +
            import os
         | 
| 31 | 
            +
            os.environ['HF_TOKEN'] = 'YOUR_TOKEN_HERE'
         | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
| 32 | 
             
            ```
         | 
| 33 |  | 
| 34 | 
             
            ERROR: 
         | 
