- Added robust CPU Fallback for AMD/Non-CUDA GPUs. - Implemented Lazy Load for AI Engine to prevent startup crashes. - Added explicit DLL injection for Cublas/Cudnn on Windows. - Added Corrupt Model Auto-Repair logic. - Includes pre-compiled v1.0.4 executable.
74 lines
2.0 KiB
Python
74 lines
2.0 KiB
Python
import os
|
|
import requests
|
|
import mimetypes
|
|
|
|
# Configuration
|
|
API_URL = "https://git.lashman.live/api/v1"
|
|
OWNER = "lashman"
|
|
REPO = "whisper_voice"
|
|
TAG = "v1.0.4"
|
|
TOKEN = "6153890332afff2d725aaf4729bc54b5030d5700" # Extracted from git config
|
|
EXE_PATH = r"dist\WhisperVoice.exe"
|
|
|
|
headers = {
|
|
"Authorization": f"token {TOKEN}",
|
|
"Accept": "application/json"
|
|
}
|
|
|
|
def create_release():
|
|
print(f"Creating release {TAG}...")
|
|
|
|
# Read Release Notes
|
|
with open("RELEASE_NOTES.md", "r", encoding="utf-8") as f:
|
|
notes = f.read()
|
|
|
|
# Create Release
|
|
payload = {
|
|
"tag_name": TAG,
|
|
"name": TAG,
|
|
"body": notes,
|
|
"draft": False,
|
|
"prerelease": False
|
|
}
|
|
|
|
url = f"{API_URL}/repos/{OWNER}/{REPO}/releases"
|
|
resp = requests.post(url, json=payload, headers=headers)
|
|
|
|
if resp.status_code == 201:
|
|
print("Release created successfully!")
|
|
return resp.json()
|
|
elif resp.status_code == 409:
|
|
print("Release already exists. Fetching it...")
|
|
# Get by tag
|
|
resp = requests.get(f"{API_URL}/repos/{OWNER}/{REPO}/releases/tags/{TAG}", headers=headers)
|
|
if resp.status_code == 200:
|
|
return resp.json()
|
|
|
|
print(f"Failed to create release: {resp.status_code} - {resp.text}")
|
|
return None
|
|
|
|
def upload_asset(release_id, file_path):
|
|
print(f"Uploading asset: {file_path}...")
|
|
filename = os.path.basename(file_path)
|
|
|
|
with open(file_path, "rb") as f:
|
|
data = f.read()
|
|
|
|
url = f"{API_URL}/repos/{OWNER}/{REPO}/releases/{release_id}/assets?name={filename}"
|
|
|
|
# Gitea API expects raw body
|
|
resp = requests.post(url, data=data, headers=headers)
|
|
|
|
if resp.status_code == 201:
|
|
print(f"Uploaded {filename} successfully!")
|
|
else:
|
|
print(f"Failed to upload asset: {resp.status_code} - {resp.text}")
|
|
|
|
def main():
|
|
release = create_release()
|
|
if release:
|
|
upload_asset(release["id"], EXE_PATH)
|
|
|
|
if __name__ == "__main__":
|
|
main()
|