Skip to content

Commit

Permalink
add x86 macos
Browse files Browse the repository at this point in the history
  • Loading branch information
tntwise5 committed Aug 21, 2024
1 parent e4c9c11 commit 6b1456c
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 27 deletions.
38 changes: 36 additions & 2 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,44 @@ jobs:
with:
name: REAL-Video-Enhancer-2.0-Windows.zip
path: REAL-Video-Enhancer-2.0-Windows.zip

build-MacOS:

# The type of runner that the job will run on
#runs-on: self-hosted-22.04
runs-on: macos-12
permissions: write-all
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11.8

- name: Checkout code
run: ls

- name: Install Python Dependencies
run: |
python3 -m pip install -r requirements.txt
- name: Build
run: python3 build.py --build_exe

- name: copy backend
run: cp -r backend dist/main/

- name: compress archive
run: zip -r REAL-Video-Enhancer-2.0-MacOS_x86_64.zip dist/main/

- name: Save Archive as artifact
uses: actions/upload-artifact@v3
with:
name: REAL-Video-Enhancer-2.0-MacOS_x86_64.zip
path: REAL-Video-Enhancer-2.0-MacOS_x86_64.zip

Release:
needs: [build-Windows, build-Linux]
needs: [build-Windows, build-Linux, build-MacOS]
runs-on: ubuntu-latest
permissions:
contents: write
Expand Down
16 changes: 5 additions & 11 deletions src/Backendhandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,11 @@ def __init__(self,parent):
self.parent = parent

def enableCorrectBackends(self):
# this is used for the initial dialog asking for dependency select and the main window, names for the variables are both the same.
#if getVendor() == "AMD":
# self.parent.downloadTorchROCmBtn.setEnabled(getPlatform() == "linux")
#else:
# self.parent.downloadTorchROCmBtn.setEnabled(False)


#if getVendor() != "Nvidia":
# self.parent.downloadTorchCUDABtn.setEnabled(False)
# self.parent.downloadTensorRTBtn.setEnabled(False)
pass
self.parent.downloadTorchROCmBtn.setEnabled(getPlatform() == "linux")
if getPlatform() == "darwin":
self.parent.downloadTorchCUDABtn.setEnabled(False)
self.parent.downloadTensorRTBtn.setEnabled(False)

def setupBackendDeps(self):
# need pop up window
from .DownloadDeps import DownloadDependencies
Expand Down
26 changes: 17 additions & 9 deletions src/DownloadDeps.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ def downloadPython(self):
link += "x86_64-unknown-linux-gnu-install_only.tar.gz"
case "win32":
link += "x86_64-pc-windows-msvc-install_only.tar.gz"
case "darwin":
link += "x86_64-apple-darwin-install_only.tar.gz"
# probably can add macos support later
printAndLog("Downloading Python")
DownloadProgressPopup(
Expand Down Expand Up @@ -156,7 +158,8 @@ def downloadFFMpeg(self):
link += "ffmpeg"
case "win32":
link += "ffmpeg.exe"

case "darwin":
link += "ffmpeg-macos-bin"
printAndLog("Downloading FFMpeg")
DownloadProgressPopup(
link=link, downloadLocation=ffmpegTempPath, title="Downloading FFMpeg"
Expand Down Expand Up @@ -257,20 +260,25 @@ def downloadNCNNDeps(self):
NCNN deps
"""
ncnnLinuxDeps = [
"https://github.com/TNTwise/Universal-NCNN-upscaler-python/releases/download/2024-07-05/upscale_ncnn_py-1.2.0-cp311-none-manylinux1_x86_64.whl",
"https://github.com/TNTwise/rife-ncnn-vulkan-python-test/releases/download/efficient_proc_bytes/rife_ncnn_vulkan_python-1.3.0-cp311-cp311-linux_x86_64.whl",
]
"https://github.com/TNTwise/real-video-enhancer-models/releases/download/models/rife_ncnn_vulkan_python-1.3.0-cp311-cp311-linux_x86_64.whl",
"https://github.com/TNTwise/real-video-enhancer-models/releases/download/models/upscale_ncnn_py-1.2.0-cp311-none-manylinux1_x86_64.whl",
] + self.getPlatformIndependentDeps()
ncnnWindowsDeps = [
"https://github.com/TNTwise/Universal-NCNN-upscaler-python/releases/download/2024-07-05/upscale_ncnn_py-1.2.0-cp311-none-win_amd64.whl",
"https://github.com/TNTwise/rife-ncnn-vulkan-python-test/releases/download/efficient_proc_bytes/rife_ncnn_vulkan_python-1.3.0-cp311-cp311-win_amd64.whl",
]
"https://github.com/TNTwise/real-video-enhancer-models/releases/download/models/rife_ncnn_vulkan_python-1.3.0-cp311-cp311-win_amd64.whl",
"https://github.com/TNTwise/real-video-enhancer-models/releases/download/models/upscale_ncnn_py-1.2.0-cp311-none-win_amd64.whl",
] + self.getPlatformIndependentDeps()
ncnnMacOSDeps = [
"https://github.com/TNTwise/real-video-enhancer-models/releases/download/models/rife_ncnn_vulkan_python-1.3.0-cp311-cp311-macosx_12_0_universal2.whl",
"https://github.com/TNTwise/real-video-enhancer-models/releases/download/models/upscale_ncnn_py-1.2.0-cp311-none-macosx_11_0_universal2.whl",
] + self.getPlatformIndependentDeps()

match getPlatform():
case "win32":
ncnnWindowsDeps += self.getPlatformIndependentDeps()
self.pipInstall(ncnnWindowsDeps)
case "linux":
ncnnLinuxDeps += self.getPlatformIndependentDeps()
self.pipInstall(ncnnLinuxDeps)
case "darwin":
self.pipInstall(ncnnMacOSDeps)

def downloadPyTorchROCmDeps(self):
rocmLinuxDeps = [
Expand Down
15 changes: 10 additions & 5 deletions src/Util.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,16 @@ def videosPath() -> str:


def ffmpegPath() -> str:
return (
os.path.join(cwd, "bin", "ffmpeg")
if getPlatform() == "darwin" or getPlatform() == "linux"
else os.path.join(cwd, "bin", "ffmpeg.exe")
)
match getPlatform():
case "linux":
return os.path.join(cwd, "bin", "ffmpeg")
case "win32":
return os.path.join(cwd, "bin", "ffmpeg.exe")
case "darwin":
return os.path.join(cwd, "bin", "ffmpeg-macos-bin")
case _:
return None



def copy(prev: str, new: str):
Expand Down

0 comments on commit 6b1456c

Please sign in to comment.