rename lupscale & add asq and gemini

from safone and upscale as visioncraft removed it
This commit is contained in:
Abhi
2024-05-31 20:52:47 +05:30
parent 4764248718
commit e2aba35a7c
2 changed files with 50 additions and 6 deletions

View File

@@ -9,8 +9,8 @@ from utils.scripts import format_exc
from utils.lexicapi import ImageGeneration, UpscaleImages, ImageModels
@Client.on_message(filters.command("lupscale", prefix) & filters.me)
async def lupscale(client: Client, message: Message):
@Client.on_message(filters.command("upscale", prefix) & filters.me)
async def upscale(client: Client, message: Message):
"""Upscale Image Using Lexica API"""
await message.edit("<code>Processing...</code>")
@@ -84,6 +84,7 @@ async def lgen(client: Client, message: Message):
with open("generated_image.png", "wb") as f:
f.write(requests.get(img_url, timeout=5).content)
await message.delete()
await client.send_document(
message.chat.id,
"generated_image.png",
@@ -97,5 +98,5 @@ async def lgen(client: Client, message: Message):
modules_help["lexica"] = {
"lgen [model_id]* [prompt/reply to prompt]*": "Generate Image with Lexica API",
"lupscale [cap/reply to image]*": "Upscale Image through Lexica API",
"upscale [cap/reply to image]*": "Upscale Image through Lexica API",
}

View File

@@ -3,7 +3,7 @@ import requests
import aiofiles
import base64
from pyrogram import Client, filters
from pyrogram import Client, enums, filters
from pyrogram.types import Message, InputMediaPhoto
from pyrogram.errors import MediaCaptionTooLong, MessageTooLong
@@ -53,6 +53,48 @@ async def voice_characters():
return ", ".join(result["characters"])
@Client.on_message(filters.command("asq", prefix) & filters.me)
async def asq(_, message: Message):
if len(message.command) > 1:
query = message.text.split(maxsplit=1)[1]
else:
await message.edit_text("Query not provided!")
return
await message.edit_text("Processing...")
response = requests.get(url=f"{url}/asq?query={query}", headers=headers, timeout=5)
if response.status_code != 200:
await message.edit_text("Something went wrong!")
return
result = response.json()
ans = result["answer"]
await message.edit_text(
f"Q. {query}\n A. {ans}", parse_mode=enums.ParseMode.MARKDOWN
)
@Client.on_message(filters.command("sgemini", prefix) & filters.me)
async def sgemini(_, message: Message):
if len(message.command) > 1:
prompt = message.text.split(maxsplit=1)[1]
else:
await message.edit_text("prompt not provided!")
return
await message.edit_text("Processing...")
response = requests.get(url=f"{url}/bard?query={prompt}", headers=headers)
if response.status_code != 200:
await message.edit_text("Something went wrong!")
return
result = response.json()
ans = result["message"]
await message.edit_text(
f"Prompt: {prompt}\n Ans: {ans}", parse_mode=enums.ParseMode.MARKDOWN
)
@Client.on_message(filters.command("app", prefix) & filters.me)
async def app(client: Client, message: Message):
try:
@@ -291,7 +333,8 @@ async def tts(client: Client, message: Message):
modules_help["safone"] = {
"app": "Search for an app on Play Store",
"tsearch": "Search Torrent",
"asq [query]*": "Asq"
"app [query]*": "Search for an app on Play Store",
"tsearch [query]*": "Search Torrent",
"tts [character]* [text/reply to text]*": "Convert Text to Speech",
}