forked from McCloudS/subgen
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/JaiZed/subgen
- Loading branch information
Showing
7 changed files
with
400 additions
and
245 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: ci | ||
name: Build_Subgen_Dockerfile | ||
|
||
on: | ||
push: | ||
|
@@ -7,11 +7,35 @@ on: | |
paths-ignore: | ||
- '**.md' | ||
- '**.yml' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
|
||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set Calver Version | ||
uses: Nelyx/[email protected] | ||
id: setcalver | ||
with: | ||
default_branch: 'refs/heads/main' | ||
format: 'YYYY.M.D' | ||
version_prefix: '' | ||
- name: Update version file | ||
run: | | ||
sed -i "s/subgen_version =.*/subgen_version = '${{ steps.setcalver.outputs.package_version }}'/" subgen/subgen.py | ||
- name: Commit and push changes | ||
run: | | ||
git config --global user.name "GitHub Actions" | ||
git config --global user.email "[email protected]" | ||
git add subgen/subgen.py | ||
git commit -m "Automated update subgen.py with version" | ||
git push | ||
- | ||
name: Login to Docker Hub | ||
uses: docker/[email protected] | ||
|
@@ -23,12 +47,4 @@ jobs: | |
uses: docker/build-push-action@v5 | ||
with: | ||
push: true | ||
tags: mccloud/subgen:latest, mccloud/subgen:cpu | ||
- | ||
name: Build and push cuda | ||
uses: docker/build-push-action@v5 | ||
with: | ||
file: ./Dockerfile.cuda | ||
push: true | ||
tags: mccloud/subgen:cuda, mccloud/subgen:gpu | ||
|
||
tags: mccloud/subgen:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,31 @@ | ||
FROM ubuntu:latest | ||
FROM nvidia/cuda:12.2.2-cudnn8-runtime-ubuntu22.04 | ||
|
||
WORKDIR /subgen | ||
|
||
RUN apt-get update && apt-get -y install python3 python3-pip ffmpeg | ||
RUN apt-get update \ | ||
&& apt-get install -y \ | ||
python3 \ | ||
python3-pip \ | ||
ffmpeg \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& pip3 install \ | ||
numpy \ | ||
stable-ts \ | ||
fastapi \ | ||
requests \ | ||
faster-whisper \ | ||
uvicorn \ | ||
python-multipart \ | ||
python-ffmpeg \ | ||
whisper \ | ||
transformers \ | ||
accelerate \ | ||
optimum | ||
|
||
ENV PYTHONUNBUFFERED 1 | ||
ENV PYTHONUNBUFFERED=1 | ||
|
||
ADD https://raw.githubusercontent.com/McCloudS/subgen/main/launcher.py /subgen/launcher.py | ||
ADD https://raw.githubusercontent.com/McCloudS/subgen/main/subgen/subgen.py /subgen/subgen.py | ||
|
||
CMD [ "python3", "-u", "./subgen.py" ] | ||
|
||
EXPOSE 8090 | ||
CMD [ "bash", "-c", "python3 -u launcher.py && python3 -u subgen.py" ] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import os | ||
import requests | ||
|
||
def convert_to_bool(in_bool): | ||
if isinstance(in_bool, bool): | ||
return in_bool | ||
else: | ||
value = str(in_bool).lower() | ||
return value not in ('false', 'off', '0', 0) | ||
|
||
def download_from_github(url, output_file): | ||
response = requests.get(url) | ||
if response.status_code == 200: | ||
with open(output_file, 'wb') as f: | ||
f.write(response.content) | ||
print(f"File downloaded successfully to {output_file}") | ||
else: | ||
print(f"Failed to download file from {url}") | ||
|
||
def main(): | ||
github_url = "https://raw.githubusercontent.com/McCloudS/subgen/main/subgen/subgen.py" | ||
output_file = "./subgen.py" | ||
|
||
# Check if the environment variable is set | ||
github_download_enabled = convert_to_bool(os.getenv("UPDATE", False)) | ||
|
||
if not os.path.exists(output_file): | ||
print(f"File {output_file} does not exist. Downloading from GitHub...") | ||
download_from_github(github_url, output_file) | ||
elif github_download_enabled: | ||
print(f"File exists, but UPDATE is set to True. Downloading {output_file} from GitHub...") | ||
download_from_github(github_url, output_file) | ||
else: | ||
print("Environment variable UPDATE is not set or set to False, skipping download.") | ||
|
||
if __name__ == "__main__": | ||
main() |
Oops, something went wrong.