Spaces:
				
			
			
	
			
			
		Sleeping
		
	
	
	
			
			
	
	
	
	
		
		
		Sleeping
		
	Upload app.py
Browse files
    	
        app.py
    CHANGED
    
    | 
         @@ -55,7 +55,34 @@ all_questions = [ 
     | 
|
| 55 | 
         
             
                "What are the risk factors for heart disease?",
         
     | 
| 56 | 
         
             
            ]
         
     | 
| 57 | 
         | 
| 58 | 
         
            -
            with gr.Blocks( 
     | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 59 | 
         
             
                interface.title = "π€ IntelliDoc: AI Document Explorer"
         
     | 
| 60 | 
         
             
                gr.Markdown("""
         
     | 
| 61 | 
         
             
                    # π€ IntelliDoc: AI Document Explorer
         
     | 
| 
         @@ -100,7 +127,7 @@ with gr.Blocks() as interface: 
     | 
|
| 100 | 
         
             
                    # Middle Section (Chat & LLM Response)
         
     | 
| 101 | 
         
             
                    with gr.Column(scale=6):
         
     | 
| 102 | 
         
             
                        gr.Markdown("## Chat with document(s)")
         
     | 
| 103 | 
         
            -
                        chat_history = gr. 
     | 
| 104 | 
         
             
                        with gr.Row():
         
     | 
| 105 | 
         
             
                            chat_input = gr.Textbox(label="Ask additional questions about the document...", show_label=False, placeholder="Ask additional questions about the document...", elem_id="chat-input", lines=3)
         
     | 
| 106 | 
         
             
                            chat_btn = gr.Button("π Send", variant="primary", elem_id="send-button", scale=0)
         
     | 
| 
         @@ -128,16 +155,6 @@ with gr.Blocks() as interface: 
     | 
|
| 128 | 
         
             
                        #gr.Markdown("## Logs")
         
     | 
| 129 | 
         
             
                        #history = gr.Textbox(label="Previous Queries", interactive=False)
         
     | 
| 130 | 
         | 
| 131 | 
         
            -
                gr.HTML("""
         
     | 
| 132 | 
         
            -
                <style>
         
     | 
| 133 | 
         
            -
                .chat-box textarea {
         
     | 
| 134 | 
         
            -
                    max-height: 600px !important;
         
     | 
| 135 | 
         
            -
                    overflow-y: auto !important;
         
     | 
| 136 | 
         
            -
                    resize: vertical;
         
     | 
| 137 | 
         
            -
                    white-space: pre-wrap;  /* Keeps formatting */
         
     | 
| 138 | 
         
            -
                }
         
     | 
| 139 | 
         
            -
                </style>
         
     | 
| 140 | 
         
            -
                """)
         
     | 
| 141 | 
         | 
| 142 | 
         
             
            if __name__ == "__main__":
         
     | 
| 143 | 
         
             
                interface.launch()
         
     | 
| 
         | 
|
| 55 | 
         
             
                "What are the risk factors for heart disease?",
         
     | 
| 56 | 
         
             
            ]
         
     | 
| 57 | 
         | 
| 58 | 
         
            +
            with gr.Blocks(css="""
         
     | 
| 59 | 
         
            +
                    .chatbot .user {
         
     | 
| 60 | 
         
            +
                        position: relative;
         
     | 
| 61 | 
         
            +
                        background-color: #cfdcfd;
         
     | 
| 62 | 
         
            +
                        padding: 12px 16px;
         
     | 
| 63 | 
         
            +
                        border-radius: 20px;
         
     | 
| 64 | 
         
            +
                        border-bottom-right-radius: 6px;
         
     | 
| 65 | 
         
            +
                        display: inline-block;
         
     | 
| 66 | 
         
            +
                        max-width: 80%;
         
     | 
| 67 | 
         
            +
                        margin: 8px 0;
         
     | 
| 68 | 
         
            +
                    }
         
     | 
| 69 | 
         
            +
             
     | 
| 70 | 
         
            +
                    /* Tail effect */
         
     | 
| 71 | 
         
            +
                    .chatbot .user::after {
         
     | 
| 72 | 
         
            +
                        content: "";
         
     | 
| 73 | 
         
            +
                        position: absolute;
         
     | 
| 74 | 
         
            +
                        right: -10px;
         
     | 
| 75 | 
         
            +
                        bottom: 10px;
         
     | 
| 76 | 
         
            +
                        width: 0;
         
     | 
| 77 | 
         
            +
                        height: 0;
         
     | 
| 78 | 
         
            +
                        border: 10px solid transparent;
         
     | 
| 79 | 
         
            +
                        border-left-color: #cfdcfd;
         
     | 
| 80 | 
         
            +
                        border-right: 0;
         
     | 
| 81 | 
         
            +
                        border-top: 0;
         
     | 
| 82 | 
         
            +
                        margin-top: -5px;
         
     | 
| 83 | 
         
            +
                    }
         
     | 
| 84 | 
         
            +
                    .chatbot .bot { background-color: #f1f8e9; padding: 8px; border-radius: 10px; }   /* Light green for bot responses */
         
     | 
| 85 | 
         
            +
                """) as interface:
         
     | 
| 86 | 
         
             
                interface.title = "π€ IntelliDoc: AI Document Explorer"
         
     | 
| 87 | 
         
             
                gr.Markdown("""
         
     | 
| 88 | 
         
             
                    # π€ IntelliDoc: AI Document Explorer
         
     | 
| 
         | 
|
| 127 | 
         
             
                    # Middle Section (Chat & LLM Response)
         
     | 
| 128 | 
         
             
                    with gr.Column(scale=6):
         
     | 
| 129 | 
         
             
                        gr.Markdown("## Chat with document(s)")
         
     | 
| 130 | 
         
            +
                        chat_history = gr.Chatbot(label="Chat History", height= 650, bubble_full_width= False, type="messages")
         
     | 
| 131 | 
         
             
                        with gr.Row():
         
     | 
| 132 | 
         
             
                            chat_input = gr.Textbox(label="Ask additional questions about the document...", show_label=False, placeholder="Ask additional questions about the document...", elem_id="chat-input", lines=3)
         
     | 
| 133 | 
         
             
                            chat_btn = gr.Button("π Send", variant="primary", elem_id="send-button", scale=0)
         
     | 
| 
         | 
|
| 155 | 
         
             
                        #gr.Markdown("## Logs")
         
     | 
| 156 | 
         
             
                        #history = gr.Textbox(label="Previous Queries", interactive=False)
         
     | 
| 157 | 
         | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 158 | 
         | 
| 159 | 
         
             
            if __name__ == "__main__":
         
     | 
| 160 | 
         
             
                interface.launch()
         
     |