Spaces:
				
			
			
	
			
			
					
		Running
		
			on 
			
			CPU Upgrade
	
	
	
			
			
	
	
	
	
		
		
					
		Running
		
			on 
			
			CPU Upgrade
	rerank model
Browse files- pages/Semantic_Search.py +30 -30
    	
        pages/Semantic_Search.py
    CHANGED
    
    | @@ -817,43 +817,43 @@ def render_answer(answer,index): | |
| 817 |  | 
| 818 | 
             
                        i = i+1
         | 
| 819 |  | 
| 820 | 
            -
             | 
| 821 | 
            -
             | 
| 822 |  | 
| 823 | 
            -
             | 
| 824 | 
            -
             | 
| 825 | 
            -
             | 
| 826 | 
            -
             | 
| 827 | 
            -
                        
         | 
| 828 | 
            -
                        def on_button_click():
         | 
| 829 | 
            -
                            if(currentValue!=oldValue):
         | 
| 830 | 
            -
                                st.session_state.input_text = st.session_state.questions[-1]["question"]
         | 
| 831 | 
            -
                                st.session_state.answers.pop()
         | 
| 832 | 
            -
                                st.session_state.questions.pop()
         | 
| 833 | 
            -
                                
         | 
| 834 | 
            -
                                handle_input()
         | 
| 835 | 
            -
                                with placeholder.container():
         | 
| 836 | 
            -
                                    render_all()
         | 
| 837 |  | 
|  | |
|  | |
|  | |
|  | |
|  | |
| 838 |  | 
|  | |
|  | |
|  | |
|  | |
|  | |
| 839 |  | 
| 840 | 
            -
             | 
| 841 | 
            -
             | 
| 842 |  | 
| 843 | 
            -
             | 
| 844 | 
            -
             | 
| 845 | 
            -
             | 
| 846 | 
            -
             | 
| 847 |  | 
| 848 | 
            -
             | 
| 849 | 
            -
             | 
| 850 | 
            -
             | 
| 851 | 
            -
             | 
| 852 | 
            -
             | 
| 853 | 
            -
             | 
| 854 |  | 
| 855 | 
            -
             | 
| 856 | 
            -
             | 
| 857 | 
             
            #Each answer will have context of the question asked in order to associate the provided feedback with the respective question
         | 
| 858 | 
             
            def write_chat_message(md, q,index):
         | 
| 859 | 
             
                if('body' in md['answer']):
         | 
|  | |
| 817 |  | 
| 818 | 
             
                        i = i+1
         | 
| 819 |  | 
| 820 | 
            +
                    with col_3:
         | 
| 821 | 
            +
                        if(index == len(st.session_state.questions)):
         | 
| 822 |  | 
| 823 | 
            +
                            rdn_key = ''.join([random.choice(string.ascii_letters)
         | 
| 824 | 
            +
                                            for _ in range(10)])
         | 
| 825 | 
            +
                            currentValue = "".join(st.session_state.input_searchType)+st.session_state.input_imageUpload+json.dumps(st.session_state.input_weightage)+st.session_state.input_NormType+st.session_state.input_CombineType+str(st.session_state.input_K)+st.session_state.input_sparse+st.session_state.input_reranker+st.session_state.input_is_rewrite_query+st.session_state.input_evaluate+st.session_state.input_image+st.session_state.input_rad_1+st.session_state.input_reranker+st.session_state.input_hybridType+st.session_state.input_manual_filter
         | 
| 826 | 
            +
                            oldValue = "".join(st.session_state.inputs_["searchType"])+st.session_state.inputs_["imageUpload"]+str(st.session_state.inputs_["weightage"])+st.session_state.inputs_["NormType"]+st.session_state.inputs_["CombineType"]+str(st.session_state.inputs_["K"])+st.session_state.inputs_["sparse"]+st.session_state.inputs_["reranker"]+st.session_state.inputs_["is_rewrite_query"]+st.session_state.inputs_["evaluate"]+st.session_state.inputs_["image"]+st.session_state.inputs_["rad_1"]+st.session_state.inputs_["reranker"]+st.session_state.inputs_["hybridType"]+st.session_state.inputs_["manual_filter"]
         | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
| 827 |  | 
| 828 | 
            +
                            def on_button_click():
         | 
| 829 | 
            +
                                if(currentValue!=oldValue):
         | 
| 830 | 
            +
                                    st.session_state.input_text = st.session_state.questions[-1]["question"]
         | 
| 831 | 
            +
                                    st.session_state.answers.pop()
         | 
| 832 | 
            +
                                    st.session_state.questions.pop()
         | 
| 833 |  | 
| 834 | 
            +
                                    handle_input()
         | 
| 835 | 
            +
                                    with placeholder.container():
         | 
| 836 | 
            +
                                        render_all()
         | 
| 837 | 
            +
                                
         | 
| 838 | 
            +
                                        
         | 
| 839 |  | 
| 840 | 
            +
                            if("currentValue"  in st.session_state):
         | 
| 841 | 
            +
                                del st.session_state["currentValue"]
         | 
| 842 |  | 
| 843 | 
            +
                            try:
         | 
| 844 | 
            +
                                del regenerate
         | 
| 845 | 
            +
                            except:
         | 
| 846 | 
            +
                                pass  
         | 
| 847 |  | 
| 848 | 
            +
                            placeholder__ = st.empty()
         | 
| 849 | 
            +
                            
         | 
| 850 | 
            +
                            placeholder__.button("🔄",key=rdn_key,on_click=on_button_click, help = "This will regenerate the responses with new settings that you entered, Note: To see difference in responses, you should change any of the applicable settings")#,type="primary",use_column_width=True)
         | 
| 851 | 
            +
                    
         | 
| 852 | 
            +
                    if(filter_out > 0):
         | 
| 853 | 
            +
                        placeholder_no_results.text(str(filter_out)+" result(s) removed due to missing or in-appropriate content")    
         | 
| 854 |  | 
| 855 | 
            +
                    
         | 
| 856 | 
            +
                    
         | 
| 857 | 
             
            #Each answer will have context of the question asked in order to associate the provided feedback with the respective question
         | 
| 858 | 
             
            def write_chat_message(md, q,index):
         | 
| 859 | 
             
                if('body' in md['answer']):
         | 
