gradio-pr-bot commited on
Commit
e632269
·
verified ·
1 Parent(s): e3b709a

Upload folder using huggingface_hub

Browse files
6.3.1/client/src/globals.d.ts CHANGED
@@ -8,5 +8,6 @@ declare global {
8
  __is_colab__: boolean;
9
  __gradio_space__: string | null;
10
  supports_zerogpu_headers?: boolean;
 
11
  }
12
  }
 
8
  __is_colab__: boolean;
9
  __gradio_space__: string | null;
10
  supports_zerogpu_headers?: boolean;
11
+ BUILD_MODE?: "dev" | "production";
12
  }
13
  }
6.3.1/client/src/helpers/init_helpers.ts CHANGED
@@ -74,59 +74,30 @@ export async function resolve_config(
74
 
75
  headers["Content-Type"] = "application/json";
76
 
77
- if (
78
- typeof window !== "undefined" &&
79
- window.gradio_config &&
80
- location.origin !== "http://localhost:9876"
81
- ) {
82
- if (window.gradio_config.current_page) {
83
- endpoint = endpoint.substring(0, endpoint.lastIndexOf("/"));
84
- }
85
- if (window.gradio_config.dev_mode) {
86
- let config_url = join_urls(
87
- endpoint,
88
- this.deep_link
89
- ? CONFIG_URL + "?deep_link=" + this.deep_link
90
- : CONFIG_URL
91
- );
92
- const response = await this.fetch(config_url, {
93
- headers,
94
- credentials: "include"
95
- });
96
- const config = await handleConfigResponse(
97
- response,
98
- endpoint,
99
- !!this.options.auth
100
- );
101
- // @ts-ignore
102
- window.gradio_config = {
103
- ...config,
104
- current_page: window.gradio_config.current_page
105
- };
106
- }
107
- window.gradio_config.root = endpoint;
108
- // @ts-ignore
109
- return { ...window.gradio_config } as Config;
110
- } else if (endpoint) {
111
- let config_url = join_urls(
112
- endpoint,
113
- this.deep_link ? CONFIG_URL + "?deep_link=" + this.deep_link : CONFIG_URL
114
- );
115
-
116
- const response = await this.fetch(config_url, {
117
- headers,
118
- credentials: "include"
119
- });
120
 
121
- return handleConfigResponse(response, endpoint, !!this.options.auth);
 
 
 
 
 
 
 
 
 
 
 
 
122
  }
123
 
124
- throw new Error(CONFIG_ERROR_MSG);
125
  }
126
 
127
  async function handleConfigResponse(
128
  response: Response,
129
- endpoint: string,
130
  authorized: boolean
131
  ): Promise<Config> {
132
  if (response?.status === 401 && !authorized) {
 
74
 
75
  headers["Content-Type"] = "application/json";
76
 
77
+ if (typeof window !== "undefined" && window?.gradio_config?.current_page) {
78
+ endpoint = endpoint.substring(0, endpoint.lastIndexOf("/"));
79
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
 
81
+ let config_url = join_urls(
82
+ endpoint,
83
+ this.deep_link ? CONFIG_URL + "?deep_link=" + this.deep_link : CONFIG_URL
84
+ );
85
+
86
+ const response = await this.fetch(config_url, {
87
+ headers,
88
+ credentials: "include"
89
+ });
90
+ const config = await handleConfigResponse(response, !!this.options.auth);
91
+
92
+ if (typeof window !== "undefined" && window?.BUILD_MODE === "dev") {
93
+ config.root = endpoint || config.root;
94
  }
95
 
96
+ return config;
97
  }
98
 
99
  async function handleConfigResponse(
100
  response: Response,
 
101
  authorized: boolean
102
  ): Promise<Config> {
103
  if (response?.status === 401 && !authorized) {