mirror of
				https://github.com/deepset-ai/haystack.git
				synced 2025-11-04 03:39:31 +00:00 
			
		
		
		
	Upgrade streamlit and adjust height of result texts dynamically (#1279)
* update to latest streamlit and st-annotated-text * improve ui results by passing dynamic height to annotated-text
This commit is contained in:
		
							parent
							
								
									2f93c2ddd5
								
							
						
					
					
						commit
						f79d9bdca6
					
				@ -1,2 +1,2 @@
 | 
			
		||||
streamlit==0.81.0
 | 
			
		||||
st-annotated-text==1.0.1
 | 
			
		||||
streamlit==0.84.0
 | 
			
		||||
st-annotated-text==1.1.0
 | 
			
		||||
 | 
			
		||||
@ -22,8 +22,9 @@ def annotate_answer(answer, context):
 | 
			
		||||
    from the API that we highlight in the given context"""
 | 
			
		||||
    start_idx = context.find(answer)
 | 
			
		||||
    end_idx = start_idx + len(answer)
 | 
			
		||||
    annotated_text(context[:start_idx], (answer, "ANSWER", "#8ef"), context[end_idx:])
 | 
			
		||||
 | 
			
		||||
    # calculate dynamic height depending on context length
 | 
			
		||||
    height = int(len(context) * 0.50) + 5
 | 
			
		||||
    annotated_text(context[:start_idx], (answer, "ANSWER", "#8ef"), context[end_idx:], height=height)
 | 
			
		||||
 | 
			
		||||
def show_plain_documents(text):
 | 
			
		||||
    """ If we are using a plain document search pipeline, i.e. only retriever, we'll get plain documents
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user