Spaces:
				
			
			
	
			
			
		Sleeping
		
	
	
	
			
			
	
	
	
	
		
		
		Sleeping
		
	Update app.py
Browse files
    	
        app.py
    CHANGED
    
    | @@ -6,12 +6,34 @@ hti = Html2Image() | |
| 6 | 
             
            client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
         | 
| 7 |  | 
| 8 |  | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
| 12 | 
             
                #css = css
         | 
| 13 | 
             
                #hti.screenshot(html_str=html, save_as='red_page.png')
         | 
| 14 | 
            -
                hti.screenshot(html_str= | 
| 15 | 
             
                return 'red_page.png'
         | 
| 16 |  | 
| 17 |  | 
|  | |
| 6 | 
             
            client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
         | 
| 7 |  | 
| 8 |  | 
| 9 | 
            +
            html_user="""
         | 
| 10 | 
            +
            <div class="user_chat">
         | 
| 11 | 
            +
            {chat}
         | 
| 12 | 
            +
            </div>
         | 
| 13 | 
            +
            """
         | 
| 14 | 
            +
            html_bot="""
         | 
| 15 | 
            +
            <div class="bot_chat">
         | 
| 16 | 
            +
            {chat}
         | 
| 17 | 
            +
            </div>
         | 
| 18 | 
            +
            """
         | 
| 19 | 
            +
            html_card="""
         | 
| 20 | 
            +
            <div class="chat_card">
         | 
| 21 | 
            +
            {body}
         | 
| 22 | 
            +
            </div>
         | 
| 23 | 
            +
            """
         | 
| 24 | 
            +
             | 
| 25 | 
            +
             | 
| 26 | 
            +
            def get_screenshot(chat,css=None):
         | 
| 27 | 
            +
                html_body=""
         | 
| 28 | 
            +
                for user,bot in history:
         | 
| 29 | 
            +
                    print (f'user::{user}')
         | 
| 30 | 
            +
                    print (f'bot::{bot}')
         | 
| 31 | 
            +
                    html_body += html_user.format(chat=user)
         | 
| 32 | 
            +
                    html_body += html_bot.format(chat=bot)
         | 
| 33 | 
            +
                html=html_card.format(body=html_body)
         | 
| 34 | 
             
                #css = css
         | 
| 35 | 
             
                #hti.screenshot(html_str=html, save_as='red_page.png')
         | 
| 36 | 
            +
                hti.screenshot(html_str=html_card, css_str=css, save_as='red_page.png')
         | 
| 37 | 
             
                return 'red_page.png'
         | 
| 38 |  | 
| 39 |  | 
