Spaces:
				
			
			
	
			
			
		Runtime error
		
	
	
	
			
			
	
	
	
	
		
		
		Runtime error
		
	full data
Browse files
    	
        app.py
    CHANGED
    
    | @@ -3,7 +3,7 @@ import os | |
| 3 | 
             
            import gradio as gr
         | 
| 4 | 
             
            import numpy as np
         | 
| 5 | 
             
            import plotly.graph_objs as go
         | 
| 6 | 
            -
            from datasets import load_dataset
         | 
| 7 | 
             
            from pymatgen.analysis.phase_diagram import PDPlotter, PhaseDiagram
         | 
| 8 | 
             
            from pymatgen.core import Composition, Structure
         | 
| 9 | 
             
            from pymatgen.core.composition import Composition
         | 
| @@ -14,25 +14,32 @@ from pymatgen.entries.computed_entries import ( | |
| 14 |  | 
| 15 | 
             
            HF_TOKEN = os.environ.get("HF_TOKEN")
         | 
| 16 |  | 
|  | |
|  | |
| 17 | 
             
            # Load only the train split of the dataset
         | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 20 | 
            -
             | 
| 21 | 
            -
                 | 
| 22 | 
            -
             | 
| 23 | 
            -
                     | 
| 24 | 
            -
                     | 
| 25 | 
            -
                     | 
| 26 | 
            -
             | 
| 27 | 
            -
             | 
| 28 | 
            -
             | 
| 29 | 
            -
             | 
| 30 | 
            -
             | 
| 31 | 
            -
             | 
| 32 | 
            -
             | 
|  | |
|  | |
|  | |
|  | |
| 33 |  | 
| 34 | 
             
            # Convert the train split to a pandas DataFrame
         | 
| 35 | 
            -
             | 
|  | |
| 36 | 
             
            del dataset
         | 
| 37 |  | 
| 38 |  | 
| @@ -141,7 +148,9 @@ warning_message += " now please take caution when analyzing the results of this" | |
| 141 | 
             
            warning_message += " application."
         | 
| 142 |  | 
| 143 |  | 
| 144 | 
            -
            message = '<div class="alert"><span class="closebtn" onclick="this.parentElement.style.display="none";">×</span>{}</div>Generate a phase diagram for a set of elements using LeMat-Bulk data.'.format( | 
|  | |
|  | |
| 145 |  | 
| 146 | 
             
            # Create Gradio interface
         | 
| 147 | 
             
            iface = gr.Interface(
         | 
|  | |
| 3 | 
             
            import gradio as gr
         | 
| 4 | 
             
            import numpy as np
         | 
| 5 | 
             
            import plotly.graph_objs as go
         | 
| 6 | 
            +
            from datasets import concatenate_datasets, load_dataset
         | 
| 7 | 
             
            from pymatgen.analysis.phase_diagram import PDPlotter, PhaseDiagram
         | 
| 8 | 
             
            from pymatgen.core import Composition, Structure
         | 
| 9 | 
             
            from pymatgen.core.composition import Composition
         | 
|  | |
| 14 |  | 
| 15 | 
             
            HF_TOKEN = os.environ.get("HF_TOKEN")
         | 
| 16 |  | 
| 17 | 
            +
            subsets = ["compatible_pbe", "compatible_pbesol", "compatible_scan", "non_compatible"]
         | 
| 18 | 
            +
             | 
| 19 | 
             
            # Load only the train split of the dataset
         | 
| 20 | 
            +
             | 
| 21 | 
            +
            datasets = []
         | 
| 22 | 
            +
            for subset in subsets:
         | 
| 23 | 
            +
                dataset = load_dataset(
         | 
| 24 | 
            +
                    "LeMaterial/leMat-Bulk",
         | 
| 25 | 
            +
                    subset,
         | 
| 26 | 
            +
                    token=HF_TOKEN,
         | 
| 27 | 
            +
                    columns=[
         | 
| 28 | 
            +
                        "lattice_vectors",
         | 
| 29 | 
            +
                        "species_at_sites",
         | 
| 30 | 
            +
                        "cartesian_site_positions",
         | 
| 31 | 
            +
                        "energy",
         | 
| 32 | 
            +
                        "energy_corrected",
         | 
| 33 | 
            +
                        "immutable_id",
         | 
| 34 | 
            +
                        "elements",
         | 
| 35 | 
            +
                        "functional",
         | 
| 36 | 
            +
                    ],
         | 
| 37 | 
            +
                )
         | 
| 38 | 
            +
                datasets.append(dataset["train"])
         | 
| 39 |  | 
| 40 | 
             
            # Convert the train split to a pandas DataFrame
         | 
| 41 | 
            +
            dataset = concatenate_datasets(datasets)
         | 
| 42 | 
            +
            train_df = dataset["train"].to_pandas()
         | 
| 43 | 
             
            del dataset
         | 
| 44 |  | 
| 45 |  | 
|  | |
| 148 | 
             
            warning_message += " application."
         | 
| 149 |  | 
| 150 |  | 
| 151 | 
            +
            message = '<div class="alert"><span class="closebtn" onclick="this.parentElement.style.display="none";">×</span>{}</div>Generate a phase diagram for a set of elements using LeMat-Bulk data.'.format(
         | 
| 152 | 
            +
                warning_message
         | 
| 153 | 
            +
            )
         | 
| 154 |  | 
| 155 | 
             
            # Create Gradio interface
         | 
| 156 | 
             
            iface = gr.Interface(
         | 

