Spaces:
				
			
			
	
			
			
		Runtime error
		
	
	
	
			
			
	
	
	
	
		
		
		Runtime error
		
	Add style column to examples
Browse files- app.py +10 -4
- samples.txt +9 -9
    	
        app.py
    CHANGED
    
    | @@ -20,8 +20,11 @@ NOTES = ''' | |
| 20 | 
             
            FOOTER = '<img id="visitor-badge" alt="visitor badge" src="https://visitor-badge.glitch.me/badge?page_id=THUDM.CogView2" />'
         | 
| 21 |  | 
| 22 |  | 
| 23 | 
            -
            def set_example_text(example: list) -> dict:
         | 
| 24 | 
            -
                return  | 
|  | |
|  | |
|  | |
| 25 |  | 
| 26 |  | 
| 27 | 
             
            def main():
         | 
| @@ -67,8 +70,11 @@ def main(): | |
| 67 | 
             
                                                       value=8,
         | 
| 68 | 
             
                                                       label='Number of Images')
         | 
| 69 | 
             
                                with open('samples.txt') as f:
         | 
| 70 | 
            -
                                    samples = [ | 
| 71 | 
            -
             | 
|  | |
|  | |
|  | |
| 72 | 
             
                                run_button = gr.Button('Run')
         | 
| 73 |  | 
| 74 | 
             
                        with gr.Column():
         | 
|  | |
| 20 | 
             
            FOOTER = '<img id="visitor-badge" alt="visitor badge" src="https://visitor-badge.glitch.me/badge?page_id=THUDM.CogView2" />'
         | 
| 21 |  | 
| 22 |  | 
| 23 | 
            +
            def set_example_text(example: list) -> list[dict]:
         | 
| 24 | 
            +
                return [
         | 
| 25 | 
            +
                    gr.Textbox.update(value=example[0]),
         | 
| 26 | 
            +
                    gr.Dropdown.update(value=example[1]),
         | 
| 27 | 
            +
                ]
         | 
| 28 |  | 
| 29 |  | 
| 30 | 
             
            def main():
         | 
|  | |
| 70 | 
             
                                                       value=8,
         | 
| 71 | 
             
                                                       label='Number of Images')
         | 
| 72 | 
             
                                with open('samples.txt') as f:
         | 
| 73 | 
            +
                                    samples = [
         | 
| 74 | 
            +
                                        line.strip().split('\t') for line in f.readlines()
         | 
| 75 | 
            +
                                    ]
         | 
| 76 | 
            +
                                examples = gr.Dataset(components=[text, style],
         | 
| 77 | 
            +
                                                      samples=samples)
         | 
| 78 | 
             
                                run_button = gr.Button('Run')
         | 
| 79 |  | 
| 80 | 
             
                        with gr.Column():
         | 
    	
        samples.txt
    CHANGED
    
    | @@ -1,9 +1,9 @@ | |
| 1 | 
            -
            A lion teacher wearing a suit is in front of a blackboard.
         | 
| 2 | 
            -
            A robot is riding under the blue and cloudy sky.
         | 
| 3 | 
            -
            A lion man is typing in the office.
         | 
| 4 | 
            -
            A pirate captain with a skull.
         | 
| 5 | 
            -
            Earth in the eye.
         | 
| 6 | 
            -
            A magnificent church. | 
| 7 | 
            -
            Mount Fuji, cherry blossom and Akita dog. | 
| 8 | 
            -
            A tiger with angel's wings.
         | 
| 9 | 
            -
            A fox is sitting on the books.
         | 
|  | |
| 1 | 
            +
            A lion teacher wearing a suit is in front of a blackboard.	mainbody
         | 
| 2 | 
            +
            A robot is riding under the blue and cloudy sky.	mainbody
         | 
| 3 | 
            +
            A lion man is typing in the office.	mainbody
         | 
| 4 | 
            +
            A pirate captain with a skull.	mainbody
         | 
| 5 | 
            +
            Earth in the eye.	mainbody
         | 
| 6 | 
            +
            A magnificent church.	sketch
         | 
| 7 | 
            +
            Mount Fuji, cherry blossom and Akita dog.	oil
         | 
| 8 | 
            +
            A tiger with angel's wings.	mainbody
         | 
| 9 | 
            +
            A fox is sitting on the books.	mainbody
         | 

