Fix build deb

This commit is contained in:
hlohaus
2025-08-22 11:23:55 +02:00
parent a909827180
commit 612e1faec5
4 changed files with 64 additions and 13 deletions

View File

@@ -48,6 +48,9 @@ jobs:
with:
python-version: "3.x"
- name: Install build tools
run: |
python -m pip install --upgrade pip
python -m pip install build twine - name: Install build tools
run: |
python -m pip install --upgrade pip
python -m pip install build twine
@@ -165,6 +168,10 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y build-essential debhelper dh-python python3-setuptools python3-dev
- name: Install build tools
run: |
python -m pip install --upgrade pip
python -m pip install build
- name: Create Debian package structure
run: |
mkdir -p debian/g4f/usr/bin

2
.gitignore vendored
View File

@@ -45,4 +45,4 @@ dist/
*.spec
pyproject.toml.bak
debian/
winget/*
winget/

View File

@@ -1,11 +1,11 @@
FROM selenium/node-chrome
FROM browserless/chrome
ARG G4F_VERSION
ENV G4F_VERSION $G4F_VERSION
ENV SE_SCREEN_WIDTH 1850
#ENV SE_SCREEN_WIDTH 1850
ENV G4F_DIR /app
ENV G4F_LOGIN_URL http://localhost:7900/?autoconnect=1&resize=scale&password=secret
#ENV G4F_LOGIN_URL http://localhost:7900/?autoconnect=1&resize=scale&password=secret
USER root
@@ -26,17 +26,17 @@ RUN apt-get -qqy update \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*
# Update entrypoint
COPY docker/supervisor.conf /etc/supervisor/conf.d/selenium.conf
COPY docker/supervisor-api.conf /etc/supervisor/conf.d/api.conf
#COPY docker/supervisor.conf /etc/supervisor/conf.d/selenium.conf
#COPY docker/supervisor-api.conf /etc/supervisor/conf.d/api.conf
# Change background image
COPY docker/background.png /usr/share/images/fluxbox/ubuntu-light.png
#COPY docker/background.png /usr/share/images/fluxbox/ubuntu-light.png
# Add user, fix permissions
RUN chown "${SEL_UID}:${SEL_GID}" $HOME/.local /opt/venv/share
#RUN chown "${SEL_UID}:${SEL_GID}" $HOME/.local /opt/venv/share
# Switch user
USER $SEL_UID
USER $BLESS_USER_ID
# Set the working directory in the container.
WORKDIR $G4F_DIR
@@ -45,11 +45,12 @@ WORKDIR $G4F_DIR
COPY requirements.txt $G4F_DIR
# Upgrade pip for the latest features and install the project's Python dependencies.
RUN pip install --break-system-packages --upgrade pip \
&& pip install --break-system-packages -r requirements.txt
RUN pip install -r requirements.txt
# Copy the entire package into the container.
ADD --chown=$SEL_UID:$SEL_GID g4f $G4F_DIR/g4f
ADD --chown=$BLESS_USER_ID:$BLESS_USER_ID g4f $G4F_DIR/g4f
# Expose ports
EXPOSE 8080 7900
EXPOSE 8080
CMD ./scripts/start.sh & python3 -m g4f --port=8080 --debug

43
test.py Normal file
View File

@@ -0,0 +1,43 @@
import asyncio
from pathlib import Path
from g4f.client import AsyncClient
from g4f.Provider import HuggingSpace, Azure
from g4f.cookies import read_cookie_files
# Load cookies and authentication environment variables needed by providers
read_cookie_files()
# Initialize asynchronous client to interact with providers
client = AsyncClient()
# Define an async function that creates an image variation using the HuggingSpace provider
async def main_with_hugging_space():
# Call create_variation with an image path, provider, model, prompt and desired response format
result = await client.images.create_variation(
image=Path("g4f.dev/docs/images/strawberry.jpg"), # Path to input image
provider=HuggingSpace, # Provider to use
model="flux-kontext-dev", # Model name for HuggingSpace
prompt="Change color to black and white", # Variation prompt
response_format="url" # Return URL to generated image
)
print(result) # Print the URL or result returned by the provider
# Define an async function that creates an image variation using the Azure provider
async def main_with_azure():
result = await client.images.create_variation(
image=Path("g4f.dev/docs/images/strawberry.jpg"),
provider=Azure,
model="flux-kontext",
prompt="Add text 'Hello World' in the center",
response_format="url"
)
print(result) # Print the returned URL or response
# Run the Azure image variation example asynchronously
asyncio.run(main_with_azure())
# Import helper function to get directory used for cookies and related files
from g4f.cookies import get_cookies_dir
# Print the directory currently used for storing cookies
print(get_cookies_dir())