Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -54,10 +54,10 @@ def get_features_single(formula):
|
|
54 |
|
55 |
def predict_features(formula):
|
56 |
try:
|
57 |
-
|
58 |
try:
|
59 |
-
comp = Composition(formula)
|
60 |
-
_ = comp.get_reduced_formula_and_factor()
|
61 |
except Exception:
|
62 |
return {"Error": "Invalid chemical formula. Please check your input and try again."}
|
63 |
|
@@ -135,7 +135,6 @@ def gradio_ui():
|
|
135 |
def update_output(formula):
|
136 |
result = predict_features(formula)
|
137 |
if "Error" in result:
|
138 |
-
# 返回错误消息到 Gradio 界面
|
139 |
return f"Error: {result['Error']}", []
|
140 |
return result.get("Predicted Layer Group Name", "Unknown"), result.get("Top 5 Predictions", [])
|
141 |
|
|
|
54 |
|
55 |
def predict_features(formula):
|
56 |
try:
|
57 |
+
|
58 |
try:
|
59 |
+
comp = Composition(formula)
|
60 |
+
_ = comp.get_reduced_formula_and_factor()
|
61 |
except Exception:
|
62 |
return {"Error": "Invalid chemical formula. Please check your input and try again."}
|
63 |
|
|
|
135 |
def update_output(formula):
|
136 |
result = predict_features(formula)
|
137 |
if "Error" in result:
|
|
|
138 |
return f"Error: {result['Error']}", []
|
139 |
return result.get("Predicted Layer Group Name", "Unknown"), result.get("Top 5 Predictions", [])
|
140 |
|