diff --git a/README.md b/README.md index bde9e5e..880fd7f 100644 --- a/README.md +++ b/README.md @@ -206,8 +206,6 @@ If you have a powerful computer or a server that you can use, but you want to us ### 1️⃣ **Set up and start the server scripts** -You need to have ollama installed on the server (We will integrate VLLM and llama.cpp soon). - On your "server" that will run the AI model, get the ip address ```sh diff --git a/install.sh b/install.sh index 0220f11..93b8cf9 100755 --- a/install.sh +++ b/install.sh @@ -37,4 +37,4 @@ case "$OS_TYPE" in ;; esac -echo "Installation process finished!" \ No newline at end of file +echo "Installation process finished!" diff --git a/server/sources/decorator.py b/server/sources/decorator.py new file mode 100644 index 0000000..737c76a --- /dev/null +++ b/server/sources/decorator.py @@ -0,0 +1,17 @@ + +def timer_decorator(func): + """ + Decorator to measure the execution time of a function. + Usage: + @timer_decorator + def my_function(): + # code to execute + """ + from time import time + def wrapper(*args, **kwargs): + start_time = time() + result = func(*args, **kwargs) + end_time = time() + print(f"\n{func.__name__} took {end_time - start_time:.2f} seconds to execute\n") + return result + return wrapper \ No newline at end of file diff --git a/server/sources/llamacpp_handler.py b/server/sources/llamacpp_handler.py index 20c6baa..16526d0 100644 --- a/server/sources/llamacpp_handler.py +++ b/server/sources/llamacpp_handler.py @@ -1,6 +1,7 @@ from .generator import GeneratorLLM from llama_cpp import Llama +from decorator import timer_decorator class LlamacppLLM(GeneratorLLM): @@ -11,6 +12,7 @@ class LlamacppLLM(GeneratorLLM): super().__init__() self.llm = None + @timer_decorator def generate(self, history): if self.llm is None: self.logger.info(f"Loading {self.model}...") diff --git a/sources/browser.py b/sources/browser.py index b82ce4e..4a192de 100644 --- a/sources/browser.py +++ b/sources/browser.py @@ -78,7 +78,7 @@ def create_driver(headless=False): class Browser: def __init__(self, driver, anticaptcha_install=True): - """Initialize the browser with optional headless mode.""" + """Initialize the browser with optional AntiCaptcha installation.""" self.js_scripts_folder = "./sources/web_scripts/" if not __name__ == "__main__" else "./web_scripts/" self.anticaptcha = "https://chrome.google.com/webstore/detail/nopecha-captcha-solver/dknlfmjaanfblgfdfebhijalfmhmjjjo/related" try: