Repository: gradio-app/gradio
File: gradio/cli/commands/deploy_space.py (Python)

Code before:
    except FileNotFoundError:
        print(
            "[bold red]gcloud CLI not found. Please install Google Cloud SDK.[/bold red]"
        )
        return False

    return True


def deploy_to_gcloud():
    """Deploy a Gradio app to Google Cloud Run. Always uses app.py as the entry point."""
    if not shutil.which("gcloud"):
        print(
            "[bold red]gcloud CLI is not installed.[/bold red]\n"
            "Please install the Google Cloud SDK from: "
            "[link]https://cloud.google.com/sdk/docs/install[/link]"
        )
        return

    if not check_gcloud_auth():
        print(
            "[bold red]Google Cloud configuration failed. Please run 'gcloud init' manually.[/bold red]"
        )
        return

    if not os.path.exists("app.py"):
        print(
            "[bold red]Error:[/bold red] app.py not found. Google Cloud Run deployment requires app.py as the entry point."
        )
        return

    requirements_file = "requirements.txt"
    if not os.path.exists(requirements_file):
        if (
            input(
                f"Create requirements.txt with gradio=={gr.__version__}? (y/n) [y]: "
            ).lower()
            != "n"
        ):
            with open(requirements_file, "w", encoding="utf-8") as f:
                f.write(f"gradio=={gr.__version__}\n")
            print(f"Created requirements.txt with gradio=={gr.__version__}")
    else:
        with open(requirements_file, encoding="utf-8") as f:
            requirements_content = f.read()

        if "gradio" not in requirements_content and (
            input(
                f"Add gradio=={gr.__version__} to requirements.txt? (y/n) [y]: "
            ).lower()
            != "n"

Review comment (suggestion):
We also look for `main.py` and take it if present. I suggest checking for either of these two files.

Code after:
        except subprocess.CalledProcessError as init_error:
            print(f"[red]Failed to run 'gcloud init': {init_error}[/red]")
            return False
    except FileNotFoundError:
        print(
            "[bold red]gcloud CLI not found. Please install Google Cloud SDK.[/bold red]"
        )
        return False

    return True


def deploy_to_gcloud():
    """Deploy a Gradio app to Google Cloud Run. Always uses app.py as the entry point."""
    if not shutil.which("gcloud"):
        print(
            "[bold red]gcloud CLI is not installed.[/bold red]\n"
            "Please install the Google Cloud SDK from: "
            "[link]https://cloud.google.com/sdk/docs/install[/link]"
        )
        return

    project_id = check_gcloud_auth()
    if not project_id:
        print(
            "[bold red]Google Cloud configuration failed. Please run 'gcloud init' manually.[/bold red]"
        )
        return

    if not os.path.exists("app.py") and not os.path.exists("main.py"):
        print(
            "[bold red]Error:[/bold red] app.py and main.py not found. Google Cloud Run deployment requires app.py or main.py as the entry point."
        )
        return

    requirements_file = "requirements.txt"
    if not os.path.exists(requirements_file):
        if (
            input(
                f"A requirements.txt file is necessary for Google Cloud Run deployment. Create requirements.txt with gradio=={gr.__version__}? (y/n) [y]: "
            ).lower()
            != "n"
        ):
            with open(requirements_file, "w", encoding="utf-8") as f:
                f.write(f"gradio=={gr.__version__}\n")
            print(f"Created requirements.txt with gradio=={gr.__version__}")
        else:
            print("\n[yellow]Deployment cancelled.[/yellow]")
            return
    else:
        with open(requirements_file, encoding="utf-8") as f: