Skip to content

Commit

Permalink
* add a note about EE Genie added to geemap
Browse files Browse the repository at this point in the history
* fix status emoji
* stop using the standalone vision model, which has been removed.

PiperOrigin-RevId: 663166356
  • Loading branch information
The Google Earth Engine Community Authors authored and copybara-github committed Aug 15, 2024
1 parent fc77ac9 commit 815c120
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion experimental/ee_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class Gemini(LLM):

def __init__(self):
self._text_model = genai.GenerativeModel('gemini-1.5-pro-latest')
self._image_model = genai.GenerativeModel('gemini-pro-vision')
self._image_model = genai.GenerativeModel('gemini-1.5-pro-latest')
self._chat_proxy = self._text_model.start_chat(history=[])

def chat(self, question: str, temperature: Optional[float] = None) -> str:
Expand Down
24 changes: 14 additions & 10 deletions experimental/ee_genie.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
{
"cell_type": "markdown",
"source": [
"**NOTE**: a more up-to-date version if this notebook\n",
"can now be found in [geemap](https://github.com/gee-community/geemap/blob/master/docs/notebooks/149_gemini.ipynb).\n",
"\n",
"\n",
"EE Genie as an interactive Earth Engine GenAI assistant that works\n",
"with geemap in Colab and can retrieve and analyze images.\n",
"\n",
Expand All @@ -17,7 +21,7 @@
"\n",
"Some other queries that work most of the time are commented out in the code where `command_input` is defined.\n",
"\n",
"The agent fetches the same tiles that are loaded on geemap (you will see them flashing in the upper left-hand corner when this happens), then stitches them together into one large image and sends it to a vision model for textual description.\n",
"The agent fetches the same tiles that are loaded on geemap (you will see them flashing in the upper left-hand corner when this happens), then stitches them together into one large image and sends it to a model for textual description.\n",
"\n",
"**Safety**\n",
"\n",
Expand Down Expand Up @@ -124,7 +128,7 @@
"analysis_model = None\n",
"map_dirty = False\n",
"\n",
"image_model = genai.GenerativeModel('gemini-pro-vision')"
"image_model = genai.GenerativeModel('gemini-1.5-pro-latest')"
],
"metadata": {
"colab": {
Expand Down Expand Up @@ -196,7 +200,7 @@
" #value='a sea port',\n",
" #value='flood consequences',\n",
" #value='show an interesting modis composite with the relevant visualization and analyze it over Costa Rica',\n",
" description='🙂',\n",
" description='',\n",
" layout=widgets.Layout(width='100%', height='50px')\n",
")\n",
"\n",
Expand Down Expand Up @@ -905,7 +909,7 @@
" 'Previous attempt returned a RECITATION error. '\n",
" 'Rephrase the answer to avoid it.')\n",
" with chat_output:\n",
" command_input.description = '😡'\n",
" command_input.description = '🆁'\n",
" time.sleep(1)\n",
" with chat_output:\n",
" command_input.description = '🤔'\n",
Expand Down Expand Up @@ -953,7 +957,7 @@
" 'Previous attempt returned a RECITATION error. '\n",
" 'Rephrase the answer to avoid it.')\n",
" with chat_output:\n",
" command_input.description = '😡'\n",
" command_input.description = '🆁'\n",
" time.sleep(1)\n",
" with chat_output:\n",
" command_input.description = '🤔'\n",
Expand Down Expand Up @@ -1048,7 +1052,7 @@
"def on_submit(widget):\n",
" global map_dirty\n",
" map_dirty = False\n",
" command_input.description = '🙂'\n",
" command_input.description = ''\n",
" command = widget.value\n",
" if not command:\n",
" command = 'go on'\n",
Expand All @@ -1064,7 +1068,7 @@
" if map_dirty:\n",
" command_input.description = '🙏'\n",
" else:\n",
" command_input.description = '🙂'\n",
" command_input.description = ''\n",
" set_cursor_default()\n",
" response = response.strip()\n",
" if not response:\n",
Expand Down Expand Up @@ -1145,11 +1149,11 @@
"\n",
"# Display the layout\n",
"display(ui)\n",
"print('🙂 = waiting for user input')\n",
"print(' = waiting for user input')\n",
"print('🙏 = waiting for user to hit enter after calling set_center()')\n",
"print('🤔 = thinking')\n",
"print('💤 = sleeping due to retries')\n",
"print('😡 = Gemini recitation error')"
"print('🆁 = Gemini recitation error')"
],
"metadata": {
"id": "5YUIQVyJ8VJc"
Expand All @@ -1170,4 +1174,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}

0 comments on commit 815c120

Please sign in to comment.