https://github.com/haseeb-heaven/gemini-interpreter
Gemini is Code generator and Code Interpreter for Google Gemini.
https://github.com/haseeb-heaven/gemini-interpreter
auto-gpt bard bard-ai bard-api bing-ai chatbot code-generation coder google google-ai google-bard-api google-cloud google-palm google-vertex-ai googlebard gpt gpt-3 python
Last synced: 6 months ago
JSON representation
Gemini is Code generator and Code Interpreter for Google Gemini.
- Host: GitHub
- URL: https://github.com/haseeb-heaven/gemini-interpreter
- Owner: haseeb-heaven
- License: mit
- Created: 2023-05-18T05:08:38.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-02-27T09:20:46.000Z (over 1 year ago)
- Last Synced: 2025-04-10T08:59:50.812Z (6 months ago)
- Topics: auto-gpt, bard, bard-ai, bard-api, bing-ai, chatbot, code-generation, coder, google, google-ai, google-bard-api, google-cloud, google-palm, google-vertex-ai, googlebard, gpt, gpt-3, python
- Language: Python
- Homepage: https://bard-interpreter.streamlit.app
- Size: 5.83 MB
- Stars: 78
- Watchers: 2
- Forks: 21
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOGS.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Gemini-Coder

### **Hosting and Spaces:**
[](https://replit.com/@HaseebMir/AutoBard-Coder)
[](https://autobard-coder.haseebmir.repl.co)
[](https://huggingface.co/spaces/haseeb-heaven/AutoBard-Coder)
[](https://haseeb-heaven-legendary-guide-x555j7vpv4phprg6-8501.preview.app.github.dev/)## ๐ General Information ๐
**Gemini-Coder** is a _code generator_ and _code interpreter_ for [Google Gemini](https://gemini.google.com/).๐๐ฉโ๐ป๐จโ๐ป It now uses the **Official** [Gemini API](https://makersuite.google.com/app/apikey) provided by Google, which is safe to use. ๐ก๏ธ
This application interacts with Google Bard and refines the results for coding purposes. ๐ฏ
The main purpose of this is for **research** ๐งช and **educational** ๐ purposes. It can be very useful for **data analysis** ๐ and **Programmers** ๐ป.## Application main UI.
### GeminiCoder:
### Code Interpreter:
## Setup Process - OUTDATED
~~To set up AutoBard-Coder, you will need to install the dependencies: `streamlit` and `bardapi`.~~
~~You will also need to authenticate with the Bard API by visiting https://bard.google.com/,~~
~~- Opening the console with F12~~
~~- Going to **Application** โ **Cookies**, and copying the value of the **__Secure-1PSID** cookie.~~
~~- Then you can setup the key to your **local environment** by running the following command:~~
~~```export _BARD_API_KEY=<__Secure-1PSID value>``` Remember the `_` before `BARD_API_KEY` is important.~~## Installation Guide - UPDATED
*Step 1:* **Obtain the Google Palm API key.**
*Step 2:* Visit the following URL: *https://makersuite.google.com/app/apikey*
*Step 3:* Click on the **Create API Key** button.
*Step 4:* The generated key is your API key. Please make sure to **copy** it and **paste** it in the required field below.
*Note:* The API key is crucial for the functioning of the AutoBard-Coder. Please ensure to keep it safe and do not share it with anyone.
## Usage
There are 3 components of this application:
1. **_Geminioder_**: A coding assistant from Gemini which automatically generates code from Gemini responses and refines it for coding purposes. This can be used by developers to get the correct code from Gemini when they need help because the output is refined and fixed multiple times to provide the correct code.
- File: `bardcoder.py`2. **_Code Interpreter_**: This is an interpreter for Gemini which can be used to run the code generated from Geminicoder. This can be very useful for all users who want to do data analysis and machine learning with Gemini. This can generate graphs and charts from Gemini responses and can be used to do data analysis.
- File: `Geminicode_interpreter.py`3. **_GeminiCoder Lib_**: This is a library for Geminicoder which can be used to generate code from bard responses and refine it for coding purposes. You can use it to build your own application using Gemini.
- File: `bardcoder_lib.py`## Using BardCoder:
To use GeminiCoder, you will need to run the following command:
```python bardcoder.py```
This will open the GeminiCoder UI in the terminal. And will be asked to enter prompts for Gemini.

Not this assumes you have already set the `API KEY` in your local environment. If you have not, please refer to the setup process.
The code generated will be placed in folder `codes` and the response will be placed in folder `response`.## Using Code Interpreter:
To use Code Interpreter, you will need to run the following command:
```streamlit run bardcode_interpreter.py```
If you need to Disable CORS Headers, you can run the following command:
```streamlit run bardcode_interpreter.py --server.enableCORS false --server.enableXsrfProtection false```
This will open the Code Interpreter UI in the Web Browser. And will be asked to enter prompts for bard.
Now this assumes you have already set the `API KEY` in your local environment. If you have not, please refer to the setup process.
You can also setup the `API KEY` in the UI settings.
Before prompting you should check the **Options** to change **Filenames** and **Filepaths** and other settings.
### Uploading data for data analysis:
You can set the `Upload Data` in **Options** to upload data for data analysis. (Right now this only supports Text files).
After uploading the files you can ask for the prompts from Gemini. And you will get the output like this.
You can also set the `Expected Output` in **Options** to get the **Accuracy** of the code generated.
And output will be generated like this with hilighting the **Accuracy** of the code generated.
### Sharing code with others:
You can share code with others by using the **ShareGPT** feature. You will get sharable link for your code.
### Code Interpreter Demo:
[Code Interpreter Demo](https://github.com/haseeb-heaven/AutoBard-Coder/blob/master/resources/code_interpreter_demo.webm)
[](https://youtube.com/shorts/Flg1qUzs9ew)The code generated will be placed in folder `codes` and the response will be placed in folder `response` and upload files will be placed in folder `uploads`.
### Safety and Measures:
This now has **safety measures** built in _Code Interpreter_ and now it can detect the **safety** of the code generated and can **fix** it.
So now all the repo and code in **READ_ONLY** mode. And you can only run the code in **READ_ONLY** mode.
All the commands which **__changes,move,delete,rename__** files are disabled in **READ_ONLY** mode.
This has advanced **safety measures** and can detect the **safety** of the code generated and can **fix** it.
### Graphs and Visual Charts output:
To get Graphs and Charts output for your data visualization, you will install python packages `matplotlib`, `seaborn`, `cartopy`, `plotnine` and more. and run the following command:
```python bardcode_interpreter.py```
And ask for the prompts from Gemini. And you will get the output like this:
Example Prompt:
```
In Python write me program to.
1.Read the data from file called 'employees.json'
2.Count no. of Males and Females in file.
4.Draw PIE graph of these in using Python Matplotlib.
5.Show me that output.
```And you will get output like this.
## Directory Structure
This application uses the Gemini API to interact with Gemini and refine the results for coding purposes. All data that is generated is stored in the following directories:
- `response`: This directory contains all the responses from Gemini.
- `codes`: This directory contains all the code generated from Gemini.
- `uploads`: This directory contains all the data that is uploaded to Gemini.
- `lib`: This directory contains all the libraries for Geminicoder.
- `resources`: This directory contains all the resources for Geminicoder.## Features
Some of the features of Gemini-Coder include:
- **Automatic** _code generation_ from Gemini responses
- **Refinement** of code for coding purposes
- Ability to **fix/debug** its own code
- Ability to generate **single** or **multiple** responses from Gemini
- Ability to **save** responses and run them locally
- Ability to access _local files_ for code interpretation
- **Data analysis** and machine learning capabilities
- **Graphs** and **Charts** generation from Gemini responses
- Ability to **upload files** for data analysis and machine learning.
- Share code with others with powerered by **ShareGPT**.
- Advanced **safety measures** to detect the safety of the code generated.## Help Section.
Now you can get help directly from the application. You can get help by clicking on the **Help** button in the UI.
## Changelog ๐
All notable changes to this project will be documented in this file.
[CHANGELOGS](https://github.com/haseeb-heaven/AutoBard-Coder/blob/master/CHANGELOGS.md)
---
| Version | Date | Added | Fixed |
| ------- | ---------- | -------------------------------------------------- | -------------------- |
| 1.4 | 2023-09-28 | - Added Palm 2 Official API now. | - Settings and Logs and Bug fixes |
| 1.3 | 2023-05-29 | - **Updated** with totally new _UI_ and _UX_. ๐จ
- Updated security for code checking and prompt checking. ๐
- Added new Help section. ๐ | - Fixed API Key issues. |
| 1.2 | 2023-05-28 | - Advanced security for code and prompt checking. ๐
- Support for graphs, charts, and tables. ๐
- More libraries for data science. ๐งฌ | |
| 1.1 | 2023-05-27 | - Upload files option. ๐ค
- API key settings. ๐ | - Error handling from server. ๐ |
| 1.0 | 2023-05-26 | - Auto barcode generator. ๐ท
- Auto barcode interpreter. ๐ | |## License and Author
Gemini-Coder was created by HeavenHM and is licensed under the MIT license.