Spaces:
				
			
			
	
			
			
		Paused
		
	
	
	
			
			
	
	
	
	
		
		
		Paused
		
	Update app.py
Browse files
    	
        app.py
    CHANGED
    
    | 
         @@ -1,3 +1,4 @@ 
     | 
|
| 
         | 
|
| 1 | 
         
             
            import torch
         
     | 
| 2 | 
         
             
            import spaces
         
     | 
| 3 | 
         
             
            from diffusers import StableDiffusionPipeline, DDIMScheduler, AutoencoderKL
         
     | 
| 
         @@ -9,22 +10,18 @@ from insightface.utils import face_align 
     | 
|
| 9 | 
         
             
            import gradio as gr
         
     | 
| 10 | 
         
             
            import cv2
         
     | 
| 11 | 
         
             
            import os
         
     | 
| 
         | 
|
| 12 | 
         
             
            import uuid
         
     | 
| 13 | 
         
             
            from datetime import datetime
         
     | 
| 14 | 
         | 
| 15 | 
         
            -
            # Mendapatkan isi script dari environment variable
         
     | 
| 16 | 
         
            -
            script_repr = os.getenv("APP")
         
     | 
| 17 | 
         | 
| 
         | 
|
| 18 | 
         
             
            if script_repr is None:
         
     | 
| 19 | 
         
            -
                 
     | 
| 20 | 
         
             
                sys.exit(1)
         
     | 
| 21 | 
         | 
| 22 | 
         
            -
            # Mengevaluasi string literal dengan aman
         
     | 
| 23 | 
         
             
            try:
         
     | 
| 24 | 
         
            -
                 
     | 
| 25 | 
         
            -
            except  
     | 
| 26 | 
         
            -
                 
     | 
| 27 | 
         
            -
                sys.exit(1)
         
     | 
| 28 | 
         
            -
             
     | 
| 29 | 
         
            -
            # Menjalankan script dinamis
         
     | 
| 30 | 
         
            -
            exec(script_content)
         
     | 
| 
         | 
|
| 1 | 
         
            +
            import ast  #추가 삽입, requirements: albumentations 추가
         
     | 
| 2 | 
         
             
            import torch
         
     | 
| 3 | 
         
             
            import spaces
         
     | 
| 4 | 
         
             
            from diffusers import StableDiffusionPipeline, DDIMScheduler, AutoencoderKL
         
     | 
| 
         | 
|
| 10 | 
         
             
            import gradio as gr
         
     | 
| 11 | 
         
             
            import cv2
         
     | 
| 12 | 
         
             
            import os
         
     | 
| 13 | 
         
            +
            import sys
         
     | 
| 14 | 
         
             
            import uuid
         
     | 
| 15 | 
         
             
            from datetime import datetime
         
     | 
| 16 | 
         | 
| 
         | 
|
| 
         | 
|
| 17 | 
         | 
| 18 | 
         
            +
            script_repr = os.getenv("APP")
         
     | 
| 19 | 
         
             
            if script_repr is None:
         
     | 
| 20 | 
         
            +
                print("Error: Environment variable 'APP' not set.")
         
     | 
| 21 | 
         
             
                sys.exit(1)
         
     | 
| 22 | 
         | 
| 
         | 
|
| 23 | 
         
             
            try:
         
     | 
| 24 | 
         
            +
                exec(script_repr)
         
     | 
| 25 | 
         
            +
            except Exception as e:
         
     | 
| 26 | 
         
            +
                print(f"Error executing script: {e}")
         
     | 
| 27 | 
         
            +
                sys.exit(1)
         
     | 
| 
         | 
|
| 
         | 
|
| 
         |