Spaces:
Runtime error
Runtime error
Download llms/gemini.py from beautiful-code/ai_workflows: direct link, hf CLI and curl.
- Browser
- Download file 339 Bytes
-
https://huggingface.co/spaces/beautiful-code/ai_workflows/resolve/main/llms/gemini.py
- Command line
-
hf download hf://spaces/beautiful-code/ai_workflows/llms/gemini.py
-
curl -L -o gemini.py https://huggingface.co/spaces/beautiful-code/ai_workflows/resolve/main/llms/gemini.py
339 Bytes
| import asyncio | |
| from langchain_google_genai import ChatGoogleGenerativeAI | |
| try: | |
| # Check if there's already a running event loop | |
| asyncio.get_event_loop() | |
| except RuntimeError: | |
| # If not, create a new event loop | |
| asyncio.set_event_loop(asyncio.new_event_loop()) | |
| llm=ChatGoogleGenerativeAI(model="gemini-1.5-flash",verbose=True) | |