| 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() | |