Nirav Madhani commited on
Commit
69e5ad7
·
1 Parent(s): e0f5a0b

Update dotenv logic

Browse files
Files changed (3) hide show
  1. .gitignore +3 -0
  2. README.md +3 -3
  3. handler.py +5 -3
.gitignore CHANGED
@@ -1,2 +1,5 @@
1
  .env
 
 
 
2
  __pycache__/*
 
1
  .env
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
  __pycache__/*
README.md CHANGED
@@ -1,5 +1,5 @@
1
  ---
2
- title: Gemini Live Audio Chat
3
  emoji: ⚡
4
  colorFrom: blue
5
  colorTo: purple
@@ -9,8 +9,8 @@ short_description: Audio chat with Gemini + tool calling + search + code run
9
  ---
10
  This project demonstrates an interactive audio and text chat interface powered by the Gemini AI model. Users can speak to the AI or type text to communicate with it.
11
 
12
- The AI is capable of calling external tools, searching for information on Google, and running code snippets. Function calling by the AI is performed on the server side, and results are sent back to the client. This approach is crucial for functions requiring access to server-side data or functionalities.
13
 
14
- A separate Space will be created later for client-side function calling.
15
 
16
  The server uses Docker for deployment, making it easy to deploy on any platform that supports Docker.
 
1
  ---
2
+ title: Gemini Live Voice Chat [Client Function Calling]
3
  emoji: ⚡
4
  colorFrom: blue
5
  colorTo: purple
 
9
  ---
10
  This project demonstrates an interactive audio and text chat interface powered by the Gemini AI model. Users can speak to the AI or type text to communicate with it.
11
 
12
+ The AI is capable of calling external tools, searching for information on Google, and running code snippets. Function calling by the AI is performed on the client side, and results are processed locally. This approach is crucial for functions requiring access to client-side data or functionalities.
13
 
14
+ For server-side function calling, visit: [Gemini Live Function Call](https://huggingface.co/spaces/Nirav121/gemini-live)
15
 
16
  The server uses Docker for deployment, making it easy to deploy on any platform that supports Docker.
handler.py CHANGED
@@ -6,10 +6,12 @@ import os
6
  import traceback
7
  from websockets.asyncio.client import connect
8
 
9
- from dotenv import load_dotenv
10
 
11
- # Load environment variables from a .env file
12
- load_dotenv()
 
 
13
 
14
  host = "generativelanguage.googleapis.com"
15
  model = "gemini-2.0-flash-exp"
 
6
  import traceback
7
  from websockets.asyncio.client import connect
8
 
9
+ import os
10
 
11
+ # Load environment variables from a .env file only if running locally
12
+ if not os.getenv('HF_SPACE_ID'):
13
+ from dotenv import load_dotenv
14
+ load_dotenv()
15
 
16
  host = "generativelanguage.googleapis.com"
17
  model = "gemini-2.0-flash-exp"