Spaces:
				
			
			
	
			
			
		Runtime error
		
	
	
	
			
			
	
	
	
	
		
		
		Runtime error
		
	Minor details
Browse files
    	
        app.py
    CHANGED
    
    | 
         @@ -31,7 +31,7 @@ def run_command(dataset, config, split, sql): 
     | 
|
| 31 | 
         | 
| 32 | 
         
             
                    parquet_files = get_parquet_files(dataset, config, split)
         
     | 
| 33 | 
         
             
                    print(f"File names found: {','.join(parquet_files)}")
         
     | 
| 34 | 
         
            -
                    parquet_first_file = parquet_files[0]
         
     | 
| 35 | 
         
             
                    print(f"Trying with the first one {parquet_first_file}")
         
     | 
| 36 | 
         
             
                    location=f"hf://datasets/{dataset}@{safe_quote(PARQUET_REVISION)}/{config}/{parquet_first_file}"
         
     | 
| 37 | 
         
             
                    print(location)
         
     | 
| 
         @@ -49,7 +49,7 @@ with gr.Blocks() as demo: 
     | 
|
| 49 | 
         
             
                config = gr.Textbox(label="config", placeholder="iris", value="iris")
         
     | 
| 50 | 
         
             
                split = gr.Textbox(label="split", placeholder="train", value="train")
         
     | 
| 51 | 
         
             
                sql = gr.Textbox(
         
     | 
| 52 | 
         
            -
                        label="Query in  
     | 
| 53 | 
         
             
                        placeholder=f"SELECT sepal_length FROM {TABLE_WILDCARD} LIMIT 3",
         
     | 
| 54 | 
         
             
                        value=f"SELECT sepal_length FROM {TABLE_WILDCARD} LIMIT 3",
         
     | 
| 55 | 
         
             
                        lines=3,
         
     | 
| 
         @@ -60,15 +60,5 @@ with gr.Blocks() as demo: 
     | 
|
| 60 | 
         
             
                run_button.click(run_command, inputs=[dataset, config, split, sql], outputs=cached_responses_table)
         
     | 
| 61 | 
         | 
| 62 | 
         | 
| 63 | 
         
            -
             
     | 
| 64 | 
         
             
            if __name__ == "__main__":
         
     | 
| 65 | 
         
             
                demo.launch()
         
     | 
| 66 | 
         
            -
             
     | 
| 67 | 
         
            -
             
     | 
| 68 | 
         
            -
             
     | 
| 69 | 
         
            -
             
     | 
| 70 | 
         
            -
            # duckdb.query(f"SELECT idx as id, premise as p FROM '{location}' LIMIT 2").show()
         
     | 
| 71 | 
         
            -
             
     | 
| 72 | 
         
            -
            # duckdb.query(f"SELECT idx as id, premise as p FROM '{location}' LIMIT 2")
         
     | 
| 73 | 
         
            -
            # duckdb.query(f"SELECT max(idx) as max FROM '{location}' LIMIT 2")
         
     | 
| 74 | 
         
            -
            # duckdb.query(f"SELECT idx  FROM '{location}'  ORDER BY idx DESC LIMIT 1").show()
         
     | 
| 
         | 
|
| 31 | 
         | 
| 32 | 
         
             
                    parquet_files = get_parquet_files(dataset, config, split)
         
     | 
| 33 | 
         
             
                    print(f"File names found: {','.join(parquet_files)}")
         
     | 
| 34 | 
         
            +
                    parquet_first_file = parquet_files[0] # TODO: Send pattern to duck db to read all split parquets
         
     | 
| 35 | 
         
             
                    print(f"Trying with the first one {parquet_first_file}")
         
     | 
| 36 | 
         
             
                    location=f"hf://datasets/{dataset}@{safe_quote(PARQUET_REVISION)}/{config}/{parquet_first_file}"
         
     | 
| 37 | 
         
             
                    print(location)
         
     | 
| 
         | 
|
| 49 | 
         
             
                config = gr.Textbox(label="config", placeholder="iris", value="iris")
         
     | 
| 50 | 
         
             
                split = gr.Textbox(label="split", placeholder="train", value="train")
         
     | 
| 51 | 
         
             
                sql = gr.Textbox(
         
     | 
| 52 | 
         
            +
                        label="Query in SQL format - It should have {table} wildcard",
         
     | 
| 53 | 
         
             
                        placeholder=f"SELECT sepal_length FROM {TABLE_WILDCARD} LIMIT 3",
         
     | 
| 54 | 
         
             
                        value=f"SELECT sepal_length FROM {TABLE_WILDCARD} LIMIT 3",
         
     | 
| 55 | 
         
             
                        lines=3,
         
     | 
| 
         | 
|
| 60 | 
         
             
                run_button.click(run_command, inputs=[dataset, config, split, sql], outputs=cached_responses_table)
         
     | 
| 61 | 
         | 
| 62 | 
         | 
| 
         | 
|
| 63 | 
         
             
            if __name__ == "__main__":
         
     | 
| 64 | 
         
             
                demo.launch()
         
     | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         |