readme update

This commit is contained in:
martin legrand 2025-03-29 21:28:42 +01:00
commit 8c431c690e
5 changed files with 21 additions and 4 deletions

View File

@ -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** ### 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 On your "server" that will run the AI model, get the ip address
```sh ```sh

View File

@ -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

View File

@ -1,6 +1,7 @@
from .generator import GeneratorLLM from .generator import GeneratorLLM
from llama_cpp import Llama from llama_cpp import Llama
from decorator import timer_decorator
class LlamacppLLM(GeneratorLLM): class LlamacppLLM(GeneratorLLM):
@ -11,6 +12,7 @@ class LlamacppLLM(GeneratorLLM):
super().__init__() super().__init__()
self.llm = None self.llm = None
@timer_decorator
def generate(self, history): def generate(self, history):
if self.llm is None: if self.llm is None:
self.logger.info(f"Loading {self.model}...") self.logger.info(f"Loading {self.model}...")

View File

@ -78,7 +78,7 @@ def create_driver(headless=False):
class Browser: class Browser:
def __init__(self, driver, anticaptcha_install=True): 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.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" self.anticaptcha = "https://chrome.google.com/webstore/detail/nopecha-captcha-solver/dknlfmjaanfblgfdfebhijalfmhmjjjo/related"
try: try: