Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,20 +1,20 @@
|
|
1 |
print("Wait..")
|
2 |
|
3 |
-
def test():
|
4 |
-
|
5 |
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
|
17 |
-
|
18 |
|
19 |
def process():
|
20 |
import subprocess
|
@@ -39,44 +39,42 @@ def process():
|
|
39 |
if "Version" in result.stdout:
|
40 |
current_version = result.stdout.split("Version:")[1].strip()
|
41 |
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
|
49 |
python_script = "entry_with_update.py"
|
50 |
|
51 |
# Argument yang ingin Anda tambahkan
|
52 |
# additional_arguments = ["--disable-xformers", "--pytorch-deterministic", "--disable-ipex-hijack", "--disable-header-check", "--disable-async-cuda-allocation", "--disable-attention-upcast", "--always-offload-from-vram", "--all-in-fp32", "--always-no-vram"]
|
53 |
-
additional_arguments = ["--always-cpu"]
|
54 |
|
55 |
# Gabungkan semua argumen
|
56 |
-
PIP = ["pip", "install", "torch_directml"]
|
57 |
command = ["python", python_script] + additional_arguments
|
58 |
|
59 |
# Jalankan skrip menggunakan subprocess
|
60 |
# print("Installing..")
|
61 |
# subprocess.run(PIP)
|
62 |
|
63 |
-
print("Running..")
|
64 |
subprocess.run(command)# Menjalankan file batch
|
65 |
# subprocess.run([batch_file_path], shell=True)
|
66 |
|
67 |
process()
|
68 |
|
69 |
-
""
|
70 |
-
launch = "process"
|
71 |
|
72 |
-
if launch == "process":
|
73 |
-
|
74 |
-
|
75 |
|
76 |
-
elif launch == "test":
|
77 |
-
|
78 |
-
|
79 |
|
80 |
-
else:
|
81 |
-
|
82 |
-
"""
|
|
|
1 |
print("Wait..")
|
2 |
|
3 |
+
# def test():
|
4 |
+
# import gradio as gr
|
5 |
|
6 |
+
# def analyze_text(text):
|
7 |
+
# # Lakukan analisis atau pemrosesan teks di sini
|
8 |
+
# result = f"Anda memasukkan teks: {text}"
|
9 |
+
# return result
|
10 |
|
11 |
+
# iface = gr.Interface(
|
12 |
+
# fn=analyze_text,
|
13 |
+
# inputs=gr.Textbox(), # Menggunakan input textbox
|
14 |
+
# outputs="text" # Menetapkan output ke tipe teks
|
15 |
+
# )
|
16 |
|
17 |
+
# iface.launch()
|
18 |
|
19 |
def process():
|
20 |
import subprocess
|
|
|
39 |
if "Version" in result.stdout:
|
40 |
current_version = result.stdout.split("Version:")[1].strip()
|
41 |
|
42 |
+
Cek dan lakukan uninstall dan install jika versi tidak sesuai
|
43 |
+
if current_version != desired_version:
|
44 |
+
uninstall_and_install_gradio(desired_version)
|
45 |
+
print(f"Gradio has been updated to version {desired_version}")
|
46 |
+
else:
|
47 |
+
print(f"Gradio is already at version {desired_version}")
|
48 |
|
49 |
python_script = "entry_with_update.py"
|
50 |
|
51 |
# Argument yang ingin Anda tambahkan
|
52 |
# additional_arguments = ["--disable-xformers", "--pytorch-deterministic", "--disable-ipex-hijack", "--disable-header-check", "--disable-async-cuda-allocation", "--disable-attention-upcast", "--always-offload-from-vram", "--all-in-fp32", "--always-no-vram"]
|
53 |
+
additional_arguments = ["--attention-split", "--attention-quad", "--always-cpu", "--always-gpu", "--all-in-fp16", "--all-in-fp32"]
|
54 |
|
55 |
# Gabungkan semua argumen
|
56 |
+
# PIP = ["pip", "install", "torch_directml"]
|
57 |
command = ["python", python_script] + additional_arguments
|
58 |
|
59 |
# Jalankan skrip menggunakan subprocess
|
60 |
# print("Installing..")
|
61 |
# subprocess.run(PIP)
|
62 |
|
63 |
+
print(f"Running.. ({python_script})")
|
64 |
subprocess.run(command)# Menjalankan file batch
|
65 |
# subprocess.run([batch_file_path], shell=True)
|
66 |
|
67 |
process()
|
68 |
|
69 |
+
# launch = "process"
|
|
|
70 |
|
71 |
+
# if launch == "process":
|
72 |
+
# process()
|
73 |
+
# print("Loading..")
|
74 |
|
75 |
+
# elif launch == "test":
|
76 |
+
# test()
|
77 |
+
# print("Loading..")
|
78 |
|
79 |
+
# else:
|
80 |
+
# print("ERROR!")
|
|