Adityadn commited on
Commit
87d0d1a
·
verified ·
1 Parent(s): bee2599

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -85
app.py DELETED
@@ -1,85 +0,0 @@
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
21
-
22
- def uninstall_and_install_gradio(version):
23
- # Uninstall current Gradio
24
- uninstall_command = ["pip", "uninstall", "gradio", "-y"]
25
- subprocess.run(uninstall_command)
26
-
27
- # Install specific version of Gradio
28
- install_command = ["pip", "install", f"gradio=={version}"]
29
- subprocess.run(install_command)
30
-
31
- # Gantilah "3.41.2" dengan versi Gradio yang diinginkan
32
- desired_version = "3.41.2"
33
-
34
- # Periksa versi Gradio yang terinstal
35
- current_version_command = ["pip", "show", "gradio"]
36
- result = subprocess.run(current_version_command, capture_output=True, text=True)
37
- current_version = None
38
-
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
- python_script = "webui.py"
51
-
52
- # Argument yang ingin Anda tambahkan
53
- # 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"]
54
- additional_arguments = ["--always-cpu", "--attention-quad", "--always-download-new-model", "--preset", "lcm"]
55
-
56
- # Gabungkan semua argumen
57
- PIP0 = ["pip", "install", "--upgrade", "pip"]
58
- PIP1 = ["pip", "install", "-r", "requirements.txt"]
59
- # PIP2 = ["pip", "install", "torch_directml"]
60
- command = ["python", python_script] + additional_arguments
61
-
62
- # Jalankan skrip menggunakan subprocess
63
- print("Installing..")
64
- subprocess.run(PIP0)
65
- subprocess.run(PIP1)
66
- # subprocess.run(PIP2)
67
-
68
- print(f"Running.. ({python_script})")
69
- subprocess.run(command)# Menjalankan file batch
70
- # subprocess.run([batch_file_path], shell=True)
71
-
72
- process()
73
-
74
- # launch = "process"
75
-
76
- # if launch == "process":
77
- # process()
78
- # print("Loading..")
79
-
80
- # elif launch == "test":
81
- # test()
82
- # print("Loading..")
83
-
84
- # else:
85
- # print("ERROR!")