Spaces:
Running
Running
File size: 631 Bytes
8e658fe f32b215 8e658fe |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
import subprocess
def install_g4f():
try:
subprocess.run(["python3", "-m", "pip", "install", "-U", "g4f[all]"], check=True)
print("g4f package installed successfully.")
except subprocess.CalledProcessError as e:
print(f"Error occurred: {e}")
print("Failed to install g4f package.")
def run_gui():
try:
from g4f.gui import run_gui
run_gui(port=7860)
except ImportError as e:
print("Error occurred while importing g4f package. Please make sure it's installed.")
print(f"Error details: {e}")
if __name__ == "__main__":
install_g4f()
run_gui()
|