Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce the analytics that are collected in Gradio #8263

Merged
merged 8 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/shaggy-tables-fly.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@gradio/app": minor
"gradio": minor
---

feat:Reduce the analytics that are collected in Gradio
1 change: 1 addition & 0 deletions client/python/test/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ def test_upload_and_download_with_auth(self):
with open(output) as f:
assert f.read() == "Hello file!"

@pytest.mark.flaky
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated but this is a flaky test and I'm not sure why

def test_cancel_from_client_queued(self, cancel_from_client_demo):
with connect(cancel_from_client_demo) as client:
start = time.time()
Expand Down
1 change: 0 additions & 1 deletion gradio/analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,6 @@ def get_inputs_outputs(
"dev_mode": blocks.dev_mode,
"show_api": blocks.show_api,
"show_error": blocks.show_error,
"title": blocks.title,
"inputs": get_inputs_outputs(
blocks.mode, blocks.input_components, inputs_telemetry
),
Expand Down
4 changes: 0 additions & 4 deletions gradio/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2479,10 +2479,6 @@ def reverse(text):
"launch_method": "browser" if inbrowser else "inline",
"is_google_colab": self.is_colab,
"is_sharing_on": self.share,
"share_url": self.share_url,
"enable_queue": True,
"server_name": server_name,
"server_port": server_port,
"is_space": self.space_id is not None,
"mode": self.mode,
}
Expand Down
15 changes: 15 additions & 0 deletions guides/01_getting-started/03_sharing-your-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ How to share your Gradio app:
6. [Mounting within FastAPI](#mounting-within-another-fast-api-app)
7. [Authentication](#authentication)
8. [Security and file access](#security-and-file-access)
9. [Analytics](#analytics)

## Sharing Demos

Expand Down Expand Up @@ -464,3 +465,17 @@ demo.launch(max_file_size=5 * gr.FileSize.MB)
```

Please make sure you are running the latest version of `gradio` for these security settings to apply.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally think this is way too much content about analytics in the getting started guide @abidlabs

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This guide is no longer in the getting started section :)

## Analytics

By default, Gradio collects certain analytics to help us better understand the usage of the `gradio` library. This includes the following information:

* What environment the Gradio app is running on (e.g. Colab Notebook, Hugging Face Spaces)
* What input/output components are being used in the Gradio app
* Whether the Gradio app is utilizing certain advanced features, such as `auth` or `show_error`
* The IP address which is used solely to measure the number of unique developers using Gradio
* The version of Gradio that is running

No information is collected from _users_ of your Gradio app. If you'd like to diable analytics altogether, you can do so by setting the `analytics_enabled` parameter to `False` in `gr.Blocks`, `gr.Interface`, or `gr.ChatInterface`. Or, you can set the GRADIO_ANALYTICS_ENABLED environment variable to `"False"` to apply this to all Gradio apps created across your system.

*Note*: this reflects the analytics policy as of `gradio>=4.32.0`.
18 changes: 0 additions & 18 deletions js/app/src/Blocks.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
export let layout: LayoutNode;
export let dependencies: Dependency[];
export let title = "Gradio";
export let analytics_enabled = false;
export let target: HTMLElement;
export let autoscroll: boolean;
export let show_api = true;
Expand Down Expand Up @@ -540,23 +539,6 @@
{#if control_page_title}
<title>{title}</title>
{/if}
{#if analytics_enabled}
<script
async
defer
src="https://www.googletagmanager.com/gtag/js?id=UA-156449732-1"
></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag("js", new Date());
gtag("config", "UA-156449732-1", {
cookie_flags: "samesite=none;secure"
});
</script>
{/if}
</svelte:head>

<div class="wrap" style:min-height={app_mode ? "100%" : "auto"}>
Expand Down