Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,19 +1,35 @@
|
|
1 |
-
import
|
2 |
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
10 |
|
11 |
-
|
12 |
-
PIP = ["pip", pip_script]
|
13 |
-
command = ["python", python_script] + additional_arguments
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
|
3 |
+
def analyze_text(text):
|
4 |
+
# Lakukan analisis atau pemrosesan teks di sini
|
5 |
+
result = f"Anda memasukkan teks: {text}"
|
6 |
+
return result
|
7 |
|
8 |
+
iface = gr.Interface(
|
9 |
+
fn=analyze_text,
|
10 |
+
inputs=gr.Textbox(), # Menggunakan input textbox
|
11 |
+
outputs="text" # Menetapkan output ke tipe teks
|
12 |
+
)
|
13 |
|
14 |
+
iface.launch()
|
|
|
|
|
15 |
|
16 |
+
def process():
|
17 |
+
import subprocess
|
18 |
+
|
19 |
+
# Gantilah "app.py" dengan nama berkas aplikasi Python Anda
|
20 |
+
pip_script = "install -r requirements.txt"
|
21 |
+
# batch_file_path = "./.run.bat"
|
22 |
+
python_script = "entry_with_update.py"
|
23 |
+
|
24 |
+
# Argument yang ingin Anda tambahkan
|
25 |
+
additional_arguments = ["--in-browser", "--vae-in-cpu", "--attention-split", "--multi-user", "--always-cpu"]
|
26 |
+
|
27 |
+
# Gabungkan semua argumen
|
28 |
+
PIP = ["pip", pip_script]
|
29 |
+
command = ["python", python_script] + additional_arguments
|
30 |
+
|
31 |
+
# Jalankan skrip menggunakan subprocess
|
32 |
+
# subprocess.run(PIP)
|
33 |
+
subprocess.run(command)# Menjalankan file batch
|
34 |
+
print(command)
|
35 |
+
# subprocess.run([batch_file_path], shell=True)
|