mirror of
https://github.com/MrSanZz/KawaiiGPT.git
synced 2026-04-29 00:59:59 +00:00
Update install.py
This commit is contained in:
26
install.py
26
install.py
@@ -1,18 +1,32 @@
|
|||||||
try:
|
try:
|
||||||
import os
|
import os
|
||||||
import requests
|
import requests
|
||||||
import subprocess
|
|
||||||
except ModuleNotFoundError as e:
|
except ModuleNotFoundError as e:
|
||||||
import os
|
import os
|
||||||
module = str(e).replace("No module named ", '').replace("'", '')
|
module = str(e).replace("No module named ", '').replace("'", '')
|
||||||
os.system(f'python3 -m pip install {module} && python3 install.py')
|
os.system(f'python3 -m pip install {module} && python3 install.py')
|
||||||
|
|
||||||
|
def check():
|
||||||
|
try:
|
||||||
|
is_android = os.path.exists('/system/bin/app_process') or os.path.exists('/system/bin/app_process32')
|
||||||
|
if is_android:
|
||||||
|
return 0
|
||||||
|
else:
|
||||||
|
return 1
|
||||||
|
except Exception as e:
|
||||||
|
return f"Error: {e}"
|
||||||
|
|
||||||
|
device = check()
|
||||||
repo_owner = 'MrSanZz'
|
repo_owner = 'MrSanZz'
|
||||||
repo_name = 'KawaiiGPT'
|
repo_name = 'KawaiiGPT'
|
||||||
files_to_check = ['kawai.py', 'requirements.txt']
|
files_to_check = ['kawai.py', 'requirements.txt']
|
||||||
package_termux = ['pkg update && pkg upgrade -y', 'pkg install git', 'pkg install python3']
|
package_termux = ['pkg update && pkg upgrade -y', 'pkg install git', 'pkg install python3']
|
||||||
package_linux = ['apt-get update && apt-get upgrade', 'apt install python3 && apt install python3-pip', 'apt install git']
|
package_linux = ['apt-get update && apt-get upgrade', 'apt install python3 && apt install python3-pip', 'apt install git']
|
||||||
|
|
||||||
|
na_support = [
|
||||||
|
"soundfile"
|
||||||
|
]
|
||||||
|
|
||||||
module = [
|
module = [
|
||||||
'prompt_toolkit',
|
'prompt_toolkit',
|
||||||
'requests',
|
'requests',
|
||||||
@@ -88,9 +102,13 @@ def install_modules():
|
|||||||
for modules in module:
|
for modules in module:
|
||||||
try:
|
try:
|
||||||
print(f"Installing {modules}...")
|
print(f"Installing {modules}...")
|
||||||
result = os.system(f'python3 -m pip install {modules}')
|
if modules in na_support and device != 0:
|
||||||
if result != 0:
|
result = os.system(f'python3 -m pip install {modules}')
|
||||||
failed_modules.append(modules)
|
if result != 0:
|
||||||
|
failed_modules.append(modules)
|
||||||
|
else:
|
||||||
|
print(f"[!] Skipped module: {modules} (Not supported in this device)")
|
||||||
|
continue
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f'[!] Module {modules} cannot be installed: {e}')
|
print(f'[!] Module {modules} cannot be installed: {e}')
|
||||||
failed_modules.append(modules)
|
failed_modules.append(modules)
|
||||||
|
|||||||
Reference in New Issue
Block a user