Spaces:
				
			
			
	
			
			
		Runtime error
		
	
	
	
			
			
	
	
	
	
		
		
		Runtime error
		
	
		Garrett Goon
		
	commited on
		
		
					Commit 
							
							·
						
						d1e787c
	
1
								Parent(s):
							
							9c4025a
								
test
Browse files- app.py +13 -5
 - requirements.txt +4 -1
 
    	
        app.py
    CHANGED
    
    | 
         @@ -1,11 +1,17 @@ 
     | 
|
| 
         | 
|
| 
         | 
|
| 1 | 
         
             
            import gradio as gr
         
     | 
| 2 | 
         
             
            import torch
         
     | 
| 
         | 
|
| 3 | 
         | 
| 4 | 
         
            -
             
     | 
| 5 | 
         
            -
            #     pretrained_model_name_or_path="weights", torch_dtype=torch.float16
         
     | 
| 6 | 
         
            -
            # )
         
     | 
| 7 | 
         | 
| 8 | 
         
            -
            # pipeline. 
     | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 9 | 
         | 
| 10 | 
         
             
            concept_to_dummy_tokens_map = torch.load("concept_to_dummy_tokens_map.pt")
         
     | 
| 11 | 
         | 
| 
         @@ -64,7 +70,9 @@ with gr.Blocks() as demo: 
     | 
|
| 64 | 
         
             
                    label="Seed",
         
     | 
| 65 | 
         
             
                    interactive=True,
         
     | 
| 66 | 
         
             
                )
         
     | 
| 67 | 
         
            -
                output = gr.Textbox( 
     | 
| 
         | 
|
| 
         | 
|
| 68 | 
         
             
                gr.Button("test").click(
         
     | 
| 69 | 
         
             
                    lambda s: replace_concept_tokens(s), inputs=[prompt], outputs=output
         
     | 
| 70 | 
         
             
                )
         
     | 
| 
         | 
|
| 1 | 
         
            +
            import os
         
     | 
| 2 | 
         
            +
             
     | 
| 3 | 
         
             
            import gradio as gr
         
     | 
| 4 | 
         
             
            import torch
         
     | 
| 5 | 
         
            +
            from diffusers import StableDiffusionPipeline
         
     | 
| 6 | 
         | 
| 7 | 
         
            +
            use_auth_token = os.environ["HF_AUTH_TOKEN"]
         
     | 
| 
         | 
|
| 
         | 
|
| 8 | 
         | 
| 9 | 
         
            +
            # pipeline = StableDiffusionPipeline.from_pretrained(
         
     | 
| 10 | 
         
            +
            #     pretrained_model_name_or_path="CompVis/stable-diffusion-v1-4",
         
     | 
| 11 | 
         
            +
            #     use_auth_token=use_auth_token,
         
     | 
| 12 | 
         
            +
            #     revision="fp16",
         
     | 
| 13 | 
         
            +
            #     torch_dtype=torch.float16,
         
     | 
| 14 | 
         
            +
            # ).to("cuda")
         
     | 
| 15 | 
         | 
| 16 | 
         
             
            concept_to_dummy_tokens_map = torch.load("concept_to_dummy_tokens_map.pt")
         
     | 
| 17 | 
         | 
| 
         | 
|
| 70 | 
         
             
                    label="Seed",
         
     | 
| 71 | 
         
             
                    interactive=True,
         
     | 
| 72 | 
         
             
                )
         
     | 
| 73 | 
         
            +
                output = gr.Textbox(
         
     | 
| 74 | 
         
            +
                    label="output", placeholder=use_auth_token[:10], interactive=False
         
     | 
| 75 | 
         
            +
                )
         
     | 
| 76 | 
         
             
                gr.Button("test").click(
         
     | 
| 77 | 
         
             
                    lambda s: replace_concept_tokens(s), inputs=[prompt], outputs=output
         
     | 
| 78 | 
         
             
                )
         
     | 
    	
        requirements.txt
    CHANGED
    
    | 
         @@ -1 +1,4 @@ 
     | 
|
| 1 | 
         
            -
             
     | 
| 
         | 
|
| 
         | 
|
| 
         | 
| 
         | 
|
| 1 | 
         
            +
            diffusers==0.5.1
         
     | 
| 2 | 
         
            +
            transformers==4.21.3
         
     | 
| 3 | 
         
            +
            ftfy==6.1.1 
         
     | 
| 4 | 
         
            +
            torch
         
     |