Spaces:
Runtime error
Runtime error
Updated interface
Browse files
app.py
CHANGED
|
@@ -68,17 +68,35 @@ Request: {user_text}"""
|
|
| 68 |
except Exception as e:
|
| 69 |
return None, f"Error: {e}", "", ""
|
| 70 |
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
gr.
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
|
| 83 |
if __name__ == "__main__":
|
| 84 |
iface.launch()
|
|
|
|
| 68 |
except Exception as e:
|
| 69 |
return None, f"Error: {e}", "", ""
|
| 70 |
|
| 71 |
+
with gr.Blocks(title="ASE+Gemini MCP Tool") as iface:
|
| 72 |
+
gr.Markdown("# ASE+Gemini Molecular Simulation Tool")
|
| 73 |
+
|
| 74 |
+
with gr.Row():
|
| 75 |
+
with gr.Column(scale=2):
|
| 76 |
+
user_prompt = gr.Textbox(
|
| 77 |
+
label="Enter your simulation prompt",
|
| 78 |
+
placeholder="e.g., 'Optimize a water molecule with DFTB+ calculator'",
|
| 79 |
+
lines=3
|
| 80 |
+
)
|
| 81 |
+
submit_btn = gr.Button("Run Simulation")
|
| 82 |
+
|
| 83 |
+
with gr.Row():
|
| 84 |
+
with gr.Column():
|
| 85 |
+
result_image = gr.Image(label="Simulation Result")
|
| 86 |
+
with gr.Column():
|
| 87 |
+
analysis = gr.Textbox(label="LLM Analysis")
|
| 88 |
+
|
| 89 |
+
with gr.Row():
|
| 90 |
+
with gr.Column():
|
| 91 |
+
prompt_sent = gr.Textbox(label="Prompt Sent to Gemini")
|
| 92 |
+
with gr.Column():
|
| 93 |
+
generated_code = gr.Code(label="Generated ASE Code")
|
| 94 |
+
|
| 95 |
+
submit_btn.click(
|
| 96 |
+
fn=mcp_tool,
|
| 97 |
+
inputs=user_prompt,
|
| 98 |
+
outputs=[result_image, analysis, prompt_sent, generated_code]
|
| 99 |
+
)
|
| 100 |
|
| 101 |
if __name__ == "__main__":
|
| 102 |
iface.launch()
|