fixed pyqt5 and other tools

This commit is contained in:
Saifeddine ALOUI 2024-10-08 21:37:39 +02:00
parent b304981082
commit 246f2e3df8
9 changed files with 136 additions and 177 deletions

View File

@ -1,10 +1,6 @@
from lollms.utilities import PackageManager, find_first_available_file_index, discussion_path_to_url
from lollms.utilities import discussion_path_to_url
from lollms.client_session import Client
from lollms.personality import APScript
if not PackageManager.check_package_installed("pyautogui"):
PackageManager.install_package("pyautogui")
if not PackageManager.check_package_installed("PyQt5"):
PackageManager.install_package("PyQt5")
from ascii_colors import trace_exception
from functools import partial
from lollms.functions.prompting.image_gen_prompts import get_image_gen_prompt, get_random_image_gen_prompt

View File

@ -1,15 +1,7 @@
from lollms.utilities import PackageManager, find_first_available_file_index, discussion_path_to_url
from lollms.utilities import find_first_available_file_index, discussion_path_to_url
from lollms.client_session import Client
from lollms.personality import APScript
if not PackageManager.check_package_installed("pyautogui"):
PackageManager.install_package("pyautogui")
if not PackageManager.check_package_installed("PyQt5"):
PackageManager.install_package("PyQt5")
from ascii_colors import trace_exception
import cv2
import time
from PyQt5 import QtWidgets, QtGui, QtCore
import sys
from functools import partial
from lollms.personality import AIPersonality
from typing import List

View File

@ -207,10 +207,6 @@ def two_paths_meme_generator_function(client: Client) -> Dict:
from lollms.utilities import PackageManager, find_first_available_file_index, discussion_path_to_url
from lollms.client_session import Client
from lollms.personality import APScript
if not PackageManager.check_package_installed("pyautogui"):
PackageManager.install_package("pyautogui")
if not PackageManager.check_package_installed("PyQt5"):
PackageManager.install_package("PyQt5")
from ascii_colors import trace_exception
from functools import partial
from PIL import Image, ImageDraw, ImageFont

View File

@ -1,20 +1,20 @@
from lollms.utilities import PackageManager, find_first_available_file_index, discussion_path_to_url
from lollms.client_session import Client
if not PackageManager.check_package_installed("pyautogui"):
PackageManager.install_package("pyautogui")
if not PackageManager.check_package_installed("PyQt5"):
PackageManager.install_package("PyQt5")
if not PackageManager.check_package_installed("cv2"):
PackageManager.install_package("opencv-python")
import cv2
import time
from PyQt5 import QtWidgets, QtGui, QtCore
import sys
from functools import partial
import pipmaster as pm
def select_image_file(processor, client):
if not pm.is_installed("PyQt5"):
pm.install("PyQt5")
if not pm.is_installed("cv2"):
pm.install("opencv-python")
import cv2
from PyQt5 import QtWidgets
app = QtWidgets.QApplication(sys.argv)
options = QtWidgets.QFileDialog.Options()
options |= QtWidgets.QFileDialog.ReadOnly

View File

@ -1,15 +1,7 @@
from lollms.utilities import PackageManager, find_first_available_file_index, discussion_path_to_url
from lollms.client_session import Client
from lollms.personality import APScript
if not PackageManager.check_package_installed("pyautogui"):
PackageManager.install_package("pyautogui")
if not PackageManager.check_package_installed("PyQt5"):
PackageManager.install_package("PyQt5")
from ascii_colors import trace_exception
import cv2
import time
from PyQt5 import QtWidgets, QtGui, QtCore
import sys
from functools import partial
from lollms.personality import AIPersonality
from typing import List

View File

@ -1,15 +1,18 @@
from lollms.utilities import PackageManager, find_first_available_file_index, discussion_path_to_url
from lollms.utilities import find_first_available_file_index, discussion_path_to_url
from lollms.client_session import Client
if not PackageManager.check_package_installed("pyautogui"):
PackageManager.install_package("pyautogui")
if not PackageManager.check_package_installed("PyQt5"):
PackageManager.install_package("PyQt5")
import sys
from functools import partial
import pipmaster as pm
def take_photo(processor, client, use_ui=False, use_a_single_photo_at_a_time=True):
if not pm.is_installed("PyQt5"):
pm.install("PyQt5")
if not pm.is_installed("cv2"):
pm.install("opencv-python")
import cv2
import time
from PyQt5 import QtWidgets, QtGui, QtCore
import sys
from functools import partial
class CameraWindow(QtWidgets.QWidget):
def __init__(self):
@ -71,8 +74,6 @@ class CameraWindow(QtWidgets.QWidget):
def closeEvent(self, event):
self.cap.release()
event.accept()
def take_photo(processor, client, use_ui=False, use_a_single_photo_at_a_time=True):
if use_ui:
def run_app():
app = QtWidgets.QApplication(sys.argv)

View File

@ -1,18 +1,20 @@
from lollms.utilities import PackageManager, find_first_available_file_index, discussion_path_to_url
from lollms.utilities import find_first_available_file_index, discussion_path_to_url
from lollms.client_session import Client
if not PackageManager.check_package_installed("pyautogui"):
PackageManager.install_package("pyautogui")
if not PackageManager.check_package_installed("PyQt5"):
PackageManager.install_package("PyQt5")
import pipmaster as pm
def take_screenshot(client: Client, use_ui: bool = False, use_a_single_photo_at_a_time= True):
if not pm.is_installed("pyautogui"):
pm.install("pyautogui")
if not pm.is_installed("PyQt5"):
pm.install("PyQt5")
import pyautogui
from PyQt5 import QtWidgets, QtGui
from PyQt5.QtCore import Qt
import sys
from functools import partial
class ScreenshotWindow(QtWidgets.QWidget):
def __init__(self, client, screenshot, fn_view, fn, use_a_single_photo_at_a_time= True):
super().__init__()
@ -49,7 +51,6 @@ class ScreenshotWindow(QtWidgets.QWidget):
self.close()
def take_screenshot(client: Client, use_ui: bool = False, use_a_single_photo_at_a_time= True):
screenshot = pyautogui.screenshot()
view_image = client.discussion.discussion_folder / "view_images"
image = client.discussion.discussion_folder / "images"

View File

@ -19,17 +19,11 @@ from lollms.utilities import PackageManager
from ascii_colors import trace_exception
# Here is an example of how we install a non installed library using PackageManager
if not PackageManager.check_package_installed("PyQt5"):
PackageManager.install_package("PyQt5")
if not PackageManager.check_package_installed("pyautogui"):
PackageManager.install_package("pyautogui")
import pipmaster as pm
# now we can import the libraries
import threading
import time
import sys
from PyQt5.QtWidgets import QApplication, QMessageBox
import pyautogui
# here is the core of the function to be built
def set_timer_with_alert(duration: int, message: str) -> str:
@ -43,6 +37,10 @@ def set_timer_with_alert(duration: int, message: str) -> str:
Returns:
str: A success message indicating the timer has been set.
"""
if not pm.is_installed("pyautogui"):
pm.install("pyautogui")
import pyautogui
def timer_callback():
try:
time.sleep(duration)

View File

@ -4,28 +4,11 @@ from typing import Optional
from base64 import b64encode
import io
from PIL import Image
from fastapi import APIRouter, Request
from fastapi import APIRouter
from lollms_webui import LOLLMSWebUI
from pydantic import BaseModel
from starlette.responses import StreamingResponse
from lollms.types import MSG_OPERATION_TYPE
from lollms.utilities import detect_antiprompt, remove_text_from_string, trace_exception
from lollms.security import sanitize_path
from ascii_colors import ASCIIColors
from lollms.databases.discussions_database import DiscussionsDB, Discussion
from lollms.security import check_access
from typing import List
from lollms.utilities import PackageManager, find_first_available_file_index, discussion_path_to_url
from lollms.client_session import Client
from lollms.personality import APScript
if not PackageManager.check_package_installed("pyautogui"):
PackageManager.install_package("pyautogui")
if not PackageManager.check_package_installed("PyQt5"):
PackageManager.install_package("PyQt5")
from ascii_colors import trace_exception
from functools import partial
from lollms.functions.prompting.image_gen_prompts import get_image_gen_prompt, get_random_image_gen_prompt
router = APIRouter()