Nandha Bot's Channel
1.47K subscribers
101 photos
50 videos
15 files
171 links
đŸ—Ŗī¸ Discussion Group - @NandhaSupport
đŸ“ĸ Network Channel - @NandhaNetwork
🛒 Market Shop - @NandhaMarket

✨ Owner: @Nandha

â„šī¸ GitHub Account:
https://github.com/nandhaxd

â„šī¸ GitHub Organization: https://github.com/Nandhabots
Download Telegram
A new image generation model
/bdraw your prompt

and added google AI ( Gemini with support image/sticker since gojo AI can't analyse face's ( so for the alternative ) we owe Gemini! /google query

By @Nandhabots Company!

Tags:
#gojoai #draw #gemini
👍1
import aiohttp


class Gemini:
def __init__(self, api_key: str):
self.api_key = api_key

async def ask(self, prompt: str, file: dict = {}) -> dict:
async with aiohttp.ClientSession() as session:
payload = {}
payload["contents"] = []
if file:
file_uri = file["file"]["uri"]
payload["contents"].append(
{
"role": "user",
"parts": [
{
"fileData": {
"fileUri": file_uri,
"mimeType": "image/jpeg"
}
},
{
"text": prompt
}
]
}
)
else:
payload["contents"].append(
{
"role": "user",
"parts": [
{
"text": prompt
}
]
}
)
payload["generationConfig"] = {
"temperature": 0.9,
"topK": 40,
"topP": 0.95,
"maxOutputTokens": 1024,
"responseMimeType": "text/plain"
}
async with session.post(f"https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash-8b-exp-0924:generateContent?key={self.api_key}", headers={"Content-Type": "application/json"}, json=payload) as response:
try:
results = await response.json()
return results
except Exception as e:
return {"error": str(e)}

async def upload_image(self, path: str) -> dict:
with open(path, "rb") as file:
async with aiohttp.ClientSession() as session:
payload = {"file": file}
async with session.post(f"https://generativelanguage.googleapis.com/upload/v1beta/files?key={self.api_key}", data=payload) as response:
try:
return await response.json()
except Exception as e:
return {"error": str(e)}
os.remove(path)


âš”ī¸ Get your API key:
https://aistudio.google.com/app/apikey


👨‍đŸ’ģ For Example:
Use @GojoAssistantBot /gemini or /google cmd replaced old model with official api


#gojoai #gemini #gojoassistant

@NandhaBots
Please open Telegram to view this post
VIEW IN TELEGRAM
👍1