Spaces:
Sleeping
A newer version of the Gradio SDK is available:
5.44.1
title: GeminiSim
emoji: ⚛️
colorFrom: gray
colorTo: yellow
sdk: gradio
sdk_version: 5.33.0
app_file: app.py
pinned: false
short_description: 'Gradio app combining ASE simulations with Gemini AI. '
tags:
- agent-demo-track
- ASE
- Gemini
- Gradio
GeminiSim - An ASE-Gemini Agentic Demo
This project is a Gradio-based Agentic Demo for running atomic and molecular simulations using the Atomic Simulation Environment (ASE), with natural language setup and analysis powered by Google's Gemini. Users can describe their simulation tasks in plain English, and the tool will set up, run, and analyze simulations automatically. Video Presentation
Features
- Natural Language Interface: Describe your simulation in everyday language.
- Automated Setup: Gemini interprets your request and generates ASE-compatible Python code.
- Simulation Execution: Runs the simulation (e.g., geometry optimization) using ASE.
- Result Analysis: Gemini summarizes and explains the simulation results.
- Visual Output: Gradio displays molecular structures and analysis.
- Code Transparency: View the generated Python code for reproducibility.
Requirements
- Python 3.8+
- ASE
- Gradio
- matplotlib
- google-generativeai (for Gemini API access)
- A Gemini API key
Install dependencies with:
pip install -r requirements.txt
Usage
Set your Gemini API Key
The application requires access to Gemini. Set your API key (replace with your actual key):
# In app.py genai.configure(api_key="YOUR_GEMINI_API_KEY")
Or, set the key as an environment variable and update the script accordingly:
export GEMINI_API_KEY="your-key-here"
Run the Application
python app.py
Open the Gradio Interface
After launching, Gradio will provide a local (and optionally public) web URL.
Enter your simulation instructions, such as:- "Optimize a water molecule and show the final geometry."
- "Simulate a methane molecule and provide a summary of the bond lengths."
How It Works
Input:
User provides a natural language description of the simulation task.LLM Parsing:
Gemini interprets the description and generates ASE setup code.Simulation:
The code is executed using ASE, running the required simulation.Analysis:
Gemini analyzes the results and provides a summary.Output:
The Gradio interface displays the molecular structure, analysis, and generated code.
Security Note
- The current implementation uses
exec()
to run code generated by the LLM. This is unsafe for untrusted input. - For production or public deployment, you must sandbox code execution (e.g., Docker, restricted Python environment).
Customization
- Easily extend for other calculators, property analysis, or support for file uploads.
- Integrate additional ASE features or other simulation backends as needed.
License
This project is provided under the MIT License. See LICENSE for details.