Fix : setup.py for browser requirement

This commit is contained in:
martin legrand 2025-03-13 14:48:02 +01:00
parent 6b2c773ebb
commit 0315d8e67f
4 changed files with 17 additions and 6 deletions

View File

@ -19,6 +19,12 @@ pyaudio==0.2.14
librosa==0.10.2.post1
selenium==4.29.0
markdownify==1.1.0
httpx>=0.27,<0.29
anyio>=3.5.0,<5
distro>=1.7.0,<2
jiter>=0.4.0,<1
sniffio
tqdm>4
# if use chinese
ordered_set
pypinyin

View File

@ -31,10 +31,15 @@ setup(
"termcolor==2.5.0",
"gliclass==0.1.8",
"ipython==8.34.0",
"pyaudio==0.2.14",
"librosa==0.10.2.post1",
"selenium==4.29.0",
"markdownify==1.1.0"
"markdownify==1.1.0",
"httpx>=0.27,<0.29"
"anyio>=3.5.0,<5"
"distro>=1.7.0,<2"
"jiter>=0.4.0,<1"
"sniffio"
"tqdm>4"
],
extras_require={
"chinese": [

View File

@ -9,6 +9,7 @@ import time
from bs4 import BeautifulSoup
import markdownify
import logging
import sys
class Browser:
def __init__(self, headless=False):
@ -24,7 +25,6 @@ class Browser:
self.wait = WebDriverWait(self.driver, 10)
self.logger = logging.getLogger(__name__)
self.logger.info("Browser initialized successfully")
except Exception as e:
raise Exception(f"Failed to initialize browser: {str(e)}")
@ -136,7 +136,7 @@ class Browser:
self.driver.quit()
self.logger.info("Browser closed")
except Exception as e:
self.logger.error(f"Error closing browser: {str(e)}")
raise e
def __del__(self):
"""Destructor to ensure browser is closed."""

View File

@ -1,5 +1,4 @@
from colorama import Fore
import pyaudio
import queue
import threading
import numpy as np
@ -15,7 +14,8 @@ class AudioRecorder:
"""
AudioRecorder is a class that records audio from the microphone and adds it to the audio queue.
"""
def __init__(self, format: int = pyaudio.paInt16, channels: int = 1, rate: int = 4096, chunk: int = 8192, record_seconds: int = 5, verbose: bool = False):
def __init__(self, format: int, channels: int = 1, rate: int = 4096, chunk: int = 8192, record_seconds: int = 5, verbose: bool = False):
import pyaudio
self.format = format
self.channels = channels
self.rate = rate