Spaces:
				
			
			
	
			
			
		Running
		
			on 
			
			Zero
	
	
	
			
			
	
	
	
	
		
		
		Running
		
			on 
			
			Zero
	
		root
		
	commited on
		
		
					Commit 
							
							·
						
						f9879d7
	
1
								Parent(s):
							
							b7ba72c
								
update app
Browse files
    	
        app.py
    CHANGED
    
    | 
         @@ -434,10 +434,14 @@ def get_example_input(): 
     | 
|
| 434 | 
         
             
                return prefix, '', suffix, test_case, task_id, ''
         
     | 
| 435 | 
         | 
| 436 | 
         
             
            def check_result(prompt, completion, suffix, test_case):
         
     | 
| 437 | 
         
            -
                 
     | 
| 438 | 
         
            -
                 
     | 
| 439 | 
         
            -
                 
     | 
| 440 | 
         
            -
                 
     | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 441 | 
         
             
                result = unsafe_execute(prompt, completion, suffix, test_case)
         
     | 
| 442 | 
         
             
                return result
         
     | 
| 443 | 
         | 
| 
         @@ -599,6 +603,8 @@ def create_chatbot_demo(): 
     | 
|
| 599 | 
         
             
                        task_id_input
         
     | 
| 600 | 
         
             
                    ]
         
     | 
| 601 | 
         | 
| 
         | 
|
| 
         | 
|
| 602 | 
         
             
                    generate_btn.click(
         
     | 
| 603 | 
         
             
                        fn=infilling_dream,
         
     | 
| 604 | 
         
             
                        inputs=generation_inputs,
         
     | 
| 
         @@ -615,7 +621,7 @@ def create_chatbot_demo(): 
     | 
|
| 615 | 
         | 
| 616 | 
         
             
                    check_btn.click(
         
     | 
| 617 | 
         
             
                        fn=check_result,
         
     | 
| 618 | 
         
            -
                        inputs= 
     | 
| 619 | 
         
             
                        outputs=[result_output],
         
     | 
| 620 | 
         
             
                        queue=False
         
     | 
| 621 | 
         
             
                    )
         
     | 
| 
         | 
|
| 434 | 
         
             
                return prefix, '', suffix, test_case, task_id, ''
         
     | 
| 435 | 
         | 
| 436 | 
         
             
            def check_result(prompt, completion, suffix, test_case):
         
     | 
| 437 | 
         
            +
                prompt = str(prompt) if prompt is not None else ""
         
     | 
| 438 | 
         
            +
                completion = str(completion) if completion is not None else ""
         
     | 
| 439 | 
         
            +
                suffix = str(suffix) if suffix is not None else ""
         
     | 
| 440 | 
         
            +
                test_case = str(test_case) if test_case is not None else ""
         
     | 
| 441 | 
         
            +
                print('prefix', prompt)
         
     | 
| 442 | 
         
            +
                print('middle', completion)
         
     | 
| 443 | 
         
            +
                print('suffix', suffix)
         
     | 
| 444 | 
         
            +
                print('test', test_case)
         
     | 
| 445 | 
         
             
                result = unsafe_execute(prompt, completion, suffix, test_case)
         
     | 
| 446 | 
         
             
                return result
         
     | 
| 447 | 
         | 
| 
         | 
|
| 603 | 
         
             
                        task_id_input
         
     | 
| 604 | 
         
             
                    ]
         
     | 
| 605 | 
         | 
| 606 | 
         
            +
                    test_inputs=[prefix_input, output_vis, suffix_input, test_case_input]
         
     | 
| 607 | 
         
            +
             
     | 
| 608 | 
         
             
                    generate_btn.click(
         
     | 
| 609 | 
         
             
                        fn=infilling_dream,
         
     | 
| 610 | 
         
             
                        inputs=generation_inputs,
         
     | 
| 
         | 
|
| 621 | 
         | 
| 622 | 
         
             
                    check_btn.click(
         
     | 
| 623 | 
         
             
                        fn=check_result,
         
     | 
| 624 | 
         
            +
                        inputs=test_inputs,
         
     | 
| 625 | 
         
             
                        outputs=[result_output],
         
     | 
| 626 | 
         
             
                        queue=False
         
     | 
| 627 | 
         
             
                    )
         
     |