Spaces:
				
			
			
	
			
			
		Running
		
			on 
			
			Zero
	
	
	
			
			
	
	
	
	
		
		
		Running
		
			on 
			
			Zero
	Update app.py
Browse files
    	
        app.py
    CHANGED
    
    | @@ -36,14 +36,14 @@ controlnet_model = 'InstantX/FLUX.1-dev-Controlnet-Canny-alpha' | |
| 36 | 
             
            # t5_slider_controlnet = T5SliderFlux(sd_pipe=pipe_controlnet,device=torch.device("cuda"))
         | 
| 37 |  | 
| 38 | 
             
            @spaces.GPU(duration=200)
         | 
| 39 | 
            -
            def generate( | 
| 40 | 
             
                         x_concept_1, x_concept_2, 
         | 
| 41 | 
             
                         avg_diff_x, 
         | 
| 42 | 
             
                         img2img_type = None, img = None, 
         | 
| 43 | 
             
                         controlnet_scale= None, ip_adapter_scale=None,
         | 
| 44 |  | 
| 45 | 
             
                         ):
         | 
| 46 | 
            -
             | 
| 47 | 
             
                # check if avg diff for directions need to be re-calculated
         | 
| 48 | 
             
                print("slider_x", slider_x)
         | 
| 49 | 
             
                print("x_concept_1", x_concept_1, "x_concept_2", x_concept_2)
         | 
| @@ -154,7 +154,7 @@ intro = """ | |
| 154 | 
             
                <img style="margin-top: -1em;margin-bottom: 0em;position: absolute;" src="https://bit.ly/3CWLGkA" alt="Duplicate Space"></a>
         | 
| 155 | 
             
            </p>
         | 
| 156 | 
             
            """
         | 
| 157 | 
            -
            with gr.Blocks( | 
| 158 |  | 
| 159 | 
             
                gr.HTML(intro)
         | 
| 160 |  | 
| @@ -171,7 +171,10 @@ with gr.Blocks(css=css) as demo: | |
| 171 | 
             
                #with gr.Tab("text2image"):
         | 
| 172 | 
             
                with gr.Row():
         | 
| 173 | 
             
                    with gr.Column():
         | 
| 174 | 
            -
                         | 
|  | |
|  | |
|  | |
| 175 | 
             
                        #slider_y = gr.Dropdown(label="Slider Y concept range", allow_custom_value=True, multiselect=True, max_choices=2)
         | 
| 176 | 
             
                        prompt = gr.Textbox(label="Prompt")
         | 
| 177 | 
             
                        x = gr.Slider(minimum=0, value=1.25, step=0.1, maximum=2.5, info="the strength to scale in each direction")
         | 
| @@ -247,7 +250,7 @@ with gr.Blocks(css=css) as demo: | |
| 247 | 
             
                #                  inputs=[slider_x, slider_y, prompt, seed, iterations, steps, guidance_scale, x_concept_1, x_concept_2, y_concept_1, y_concept_2, avg_diff_x, avg_diff_y],
         | 
| 248 | 
             
                #                  outputs=[x, y, x_concept_1, x_concept_2, y_concept_1, y_concept_2, avg_diff_x, avg_diff_y, output_image])
         | 
| 249 | 
             
                submit.click(fn=generate,
         | 
| 250 | 
            -
                                 inputs=[ | 
| 251 | 
             
                                 outputs=[x, x_concept_1, x_concept_2, avg_diff_x, output_image, image_seq])
         | 
| 252 |  | 
| 253 | 
             
                iterations.change(fn=reset_recalc_directions, outputs=[recalc_directions])
         | 
|  | |
| 36 | 
             
            # t5_slider_controlnet = T5SliderFlux(sd_pipe=pipe_controlnet,device=torch.device("cuda"))
         | 
| 37 |  | 
| 38 | 
             
            @spaces.GPU(duration=200)
         | 
| 39 | 
            +
            def generate(concept_1, concept_2, scale, prompt, seed, recalc_directions, iterations, steps, interm_steps, guidance_scale,
         | 
| 40 | 
             
                         x_concept_1, x_concept_2, 
         | 
| 41 | 
             
                         avg_diff_x, 
         | 
| 42 | 
             
                         img2img_type = None, img = None, 
         | 
| 43 | 
             
                         controlnet_scale= None, ip_adapter_scale=None,
         | 
| 44 |  | 
| 45 | 
             
                         ):
         | 
| 46 | 
            +
                slider_x = [concept_1, concept_2]
         | 
| 47 | 
             
                # check if avg diff for directions need to be re-calculated
         | 
| 48 | 
             
                print("slider_x", slider_x)
         | 
| 49 | 
             
                print("x_concept_1", x_concept_1, "x_concept_2", x_concept_2)
         | 
|  | |
| 154 | 
             
                <img style="margin-top: -1em;margin-bottom: 0em;position: absolute;" src="https://bit.ly/3CWLGkA" alt="Duplicate Space"></a>
         | 
| 155 | 
             
            </p>
         | 
| 156 | 
             
            """
         | 
| 157 | 
            +
            with gr.Blocks() as demo:
         | 
| 158 |  | 
| 159 | 
             
                gr.HTML(intro)
         | 
| 160 |  | 
|  | |
| 171 | 
             
                #with gr.Tab("text2image"):
         | 
| 172 | 
             
                with gr.Row():
         | 
| 173 | 
             
                    with gr.Column():
         | 
| 174 | 
            +
                        with gr.Row():
         | 
| 175 | 
            +
                            concept_1 = gr.Textbox(label="A concept to compare")
         | 
| 176 | 
            +
                            concept_2 = gr.Textbox(label="Concept to compare")
         | 
| 177 | 
            +
                        #slider_x = gr.Dropdown(label="Slider concept range", allow_custom_value=True, multiselect=True, max_choices=2)
         | 
| 178 | 
             
                        #slider_y = gr.Dropdown(label="Slider Y concept range", allow_custom_value=True, multiselect=True, max_choices=2)
         | 
| 179 | 
             
                        prompt = gr.Textbox(label="Prompt")
         | 
| 180 | 
             
                        x = gr.Slider(minimum=0, value=1.25, step=0.1, maximum=2.5, info="the strength to scale in each direction")
         | 
|  | |
| 250 | 
             
                #                  inputs=[slider_x, slider_y, prompt, seed, iterations, steps, guidance_scale, x_concept_1, x_concept_2, y_concept_1, y_concept_2, avg_diff_x, avg_diff_y],
         | 
| 251 | 
             
                #                  outputs=[x, y, x_concept_1, x_concept_2, y_concept_1, y_concept_2, avg_diff_x, avg_diff_y, output_image])
         | 
| 252 | 
             
                submit.click(fn=generate,
         | 
| 253 | 
            +
                                 inputs=[concept_1, concept_2, x, prompt, seed, recalc_directions, iterations, steps, interm_steps, guidance_scale, x_concept_1, x_concept_2, avg_diff_x],
         | 
| 254 | 
             
                                 outputs=[x, x_concept_1, x_concept_2, avg_diff_x, output_image, image_seq])
         | 
| 255 |  | 
| 256 | 
             
                iterations.change(fn=reset_recalc_directions, outputs=[recalc_directions])
         | 
