Himan-de commited on
Commit
e0789da
ยท
verified ยท
1 Parent(s): c3df961

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. README.md +33 -0
  2. app.py +45 -0
  3. requirements.txt +2 -0
README.md ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ tags:
4
+ - materials-science
5
+ - deep-learning
6
+ - crystal-structure
7
+ - chemistry
8
+ ---
9
+
10
+ # ๐Ÿ”ฌ MatGraph CLI
11
+
12
+ A modern CLI and GraphQL API tool for Material Science Deep Learning Pipelines.
13
+
14
+ **Powered by M3GNet Universal Potentials**
15
+
16
+ This repository contains the Gradio Space logic and documentation for `matgraph-cli`.
17
+
18
+ ## ๐Ÿš€ Installation
19
+ ```bash
20
+ pip install matgraph-cli
21
+ ```
22
+
23
+ ## ๐Ÿ›  Features
24
+ - Predict Thermodynamic Stability (M3GNet)
25
+ - Structural Relaxation & Geometry Optimization (ASE)
26
+ - Generative Discovery via Elemental Substitution
27
+ - X-Ray Diffraction (XRD) Simulation
28
+ - Phonon Density of States (DOS)
29
+ - High-Performance GraphQL Server
30
+
31
+ ## ๐Ÿ”— Links
32
+ - [GitHub Repository](https://github.com/Himan-D/matgraph-cli)
33
+ - [PyPI Package](https://pypi.org/project/matgraph-cli/)
app.py ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from matgraph.sdk import MatGraphSDK
3
+ import pandas as pd
4
+
5
+ def predict_material(formula, api_key):
6
+ if not api_key:
7
+ return "Please enter your Materials Project API Key."
8
+
9
+ try:
10
+ sdk = MatGraphSDK(api_key=api_key)
11
+ results = sdk.predict(formula=formula, model="m3gnet")
12
+
13
+ if not results:
14
+ return "No data found for this formula."
15
+
16
+ # Format results into a dataframe
17
+ df = pd.DataFrame([{
18
+ "ID": r["material_id"],
19
+ "Formula": r["formula"],
20
+ "Crystal System": r["crystal_system"],
21
+ "Predicted Energy (eV)": round(r["m3gnet_energy"], 3) if r.get("m3gnet_energy") else "N/A"
22
+ } for r in results])
23
+
24
+ return df
25
+ except Exception as e:
26
+ return f"Error: {str(e)}"
27
+
28
+ with gr.Blocks(title="MatGraph CLI: Deep Learning for Material Science", theme=gr.themes.Soft()) as demo:
29
+ gr.Markdown("# ๐Ÿ”ฌ MatGraph Explorer")
30
+ gr.Markdown("Predict thermodynamic stability and properties of materials using M3GNet Universal Potentials.")
31
+
32
+ with gr.Row():
33
+ with gr.Column():
34
+ formula_input = gr.Textbox(label="Chemical Formula (e.g., LiFePO4)", placeholder="LiFePO4")
35
+ api_input = gr.Textbox(label="Materials Project API Key", type="password")
36
+ btn = gr.Button("Predict Properties", variant="primary")
37
+
38
+ with gr.Column():
39
+ output_table = gr.Dataframe(label="Polymorph Predictions")
40
+
41
+ btn.click(fn=predict_material, inputs=[formula_input, api_input], outputs=[output_table])
42
+
43
+ gr.Markdown("Powered by [matgraph-cli](https://pypi.org/project/matgraph-cli/)")
44
+
45
+ demo.launch()
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ matgraph-cli==1.5.1
2
+ pandas