Adityadn commited on
Commit
9c91e2d
·
verified ·
1 Parent(s): cd6b3ac

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -15
app.py CHANGED
@@ -1,19 +1,35 @@
1
- import subprocess
2
 
3
- # Gantilah "app.py" dengan nama berkas aplikasi Python Anda
4
- pip_script = "install -r requirements.txt"
5
- # batch_file_path = "./.run.bat"
6
- python_script = "entry_with_update.py"
7
 
8
- # Argument yang ingin Anda tambahkan
9
- additional_arguments = ["--in-browser", "--vae-in-cpu", "--attention-split", "--multi-user", "--always-cpu"]
 
 
 
10
 
11
- # Gabungkan semua argumen
12
- PIP = ["pip", pip_script]
13
- command = ["python", python_script] + additional_arguments
14
 
15
- # Jalankan skrip menggunakan subprocess
16
- # subprocess.run(PIP)
17
- subprocess.run(command)# Menjalankan file batch
18
- print(command)
19
- # subprocess.run([batch_file_path], shell=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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)