Spaces:
				
			
			
	
			
			
		Sleeping
		
	
	
	
			
			
	
	
	
	
		
		
		Sleeping
		
	Update app.py
Browse files
    	
        app.py
    CHANGED
    
    | @@ -91,15 +91,23 @@ else: | |
| 91 | 
             
                                # Process TAPAS-related questions if it's not a graph query
         | 
| 92 | 
             
                                raw_answer = tqa(table=df, query=question, truncation=True)
         | 
| 93 |  | 
| 94 | 
            -
                                # Display raw answer from TAPAS
         | 
| 95 | 
            -
                                st.markdown("<p style='font-family:sans-serif;font-size:  | 
| 96 | 
            -
                                st.write(raw_answer)  # Display the raw  | 
| 97 |  | 
| 98 | 
            -
                                 | 
|  | |
| 99 | 
             
                                aggregator = raw_answer.get('aggregator', '')
         | 
| 100 | 
             
                                coordinates = raw_answer.get('coordinates', [])
         | 
| 101 | 
             
                                cells = raw_answer.get('cells', [])
         | 
| 102 |  | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
| 103 | 
             
                                # Handle different aggregators
         | 
| 104 | 
             
                                if 'average' in question.lower() or aggregator == 'AVG':
         | 
| 105 | 
             
                                    avg_value = df.mean().mean()  # Calculate overall average
         | 
|  | |
| 91 | 
             
                                # Process TAPAS-related questions if it's not a graph query
         | 
| 92 | 
             
                                raw_answer = tqa(table=df, query=question, truncation=True)
         | 
| 93 |  | 
| 94 | 
            +
                                # Display raw answer from TAPAS on the screen
         | 
| 95 | 
            +
                                st.markdown("<p style='font-family:sans-serif;font-size: 1rem;'>Raw TAPAS Answer: </p>", unsafe_allow_html=True)
         | 
| 96 | 
            +
                                st.write(raw_answer)  # Display the raw TAPAS output
         | 
| 97 |  | 
| 98 | 
            +
                                # Ensure that the output from TAPAS is processed for Plotly
         | 
| 99 | 
            +
                                answer = raw_answer.get('answer', '')
         | 
| 100 | 
             
                                aggregator = raw_answer.get('aggregator', '')
         | 
| 101 | 
             
                                coordinates = raw_answer.get('coordinates', [])
         | 
| 102 | 
             
                                cells = raw_answer.get('cells', [])
         | 
| 103 |  | 
| 104 | 
            +
                                # Display relevant data from TAPAS output to be used by Plotly
         | 
| 105 | 
            +
                                st.markdown("<p style='font-family:sans-serif;font-size: 1rem;'>Relevant Data for Plotly: </p>", unsafe_allow_html=True)
         | 
| 106 | 
            +
                                st.write(f"Answer: {answer}")
         | 
| 107 | 
            +
                                st.write(f"Aggregator: {aggregator}")
         | 
| 108 | 
            +
                                st.write(f"Coordinates: {coordinates}")
         | 
| 109 | 
            +
                                st.write(f"Cells: {cells}")
         | 
| 110 | 
            +
             | 
| 111 | 
             
                                # Handle different aggregators
         | 
| 112 | 
             
                                if 'average' in question.lower() or aggregator == 'AVG':
         | 
| 113 | 
             
                                    avg_value = df.mean().mean()  # Calculate overall average
         | 
