MrDonStuff commited on
Commit
8e658fe
·
verified ·
1 Parent(s): e80b12c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -4
app.py CHANGED
@@ -1,5 +1,21 @@
1
- from subprocess import run
2
- from g4f.gui import run_gui
3
- run('python3 -m pip install -U g4f[all]').stdout
4
 
5
- run_gui(port=7860)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import subprocess
 
 
2
 
3
+ def install_g4f():
4
+ try:
5
+ subprocess.run(["python3", "-m", "pip", "install", "-U", "g4f[all]"], check=True)
6
+ print("g4f package installed successfully.")
7
+ except subprocess.CalledProcessError as e:
8
+ print(f"Error occurred: {e}")
9
+ print("Failed to install g4f package.")
10
+
11
+ def run_gui():
12
+ try:
13
+ from g4f.gui import run_gui
14
+ run_gui(port=7860)
15
+ except ImportError as e:
16
+ print("Error occurred while importing g4f package. Please make sure it's installed.")
17
+ print(f"Error details: {e}")
18
+
19
+ if __name__ == "__main__":
20
+ install_g4f()
21
+ run_gui()