Update app.py
Browse files
app.py
CHANGED
|
@@ -237,11 +237,23 @@ with gr.Blocks() as demo:
|
|
| 237 |
print(f"DEBUG: Error getting URL params: {e}")
|
| 238 |
return '', '', ''
|
| 239 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 240 |
search_btn.click(query, inputs=[repo_box, pr_box, sha_box], outputs=[table, json_view, status])
|
| 241 |
refresh_btn.click(refresh_dataset, outputs=status)
|
| 242 |
|
| 243 |
-
# Load URL parameters when page loads
|
| 244 |
-
demo.load(get_url_params, outputs=[repo_box, pr_box, sha_box])
|
|
|
|
|
|
|
|
|
|
|
|
|
| 245 |
|
| 246 |
if __name__ == "__main__":
|
| 247 |
demo.queue(max_size=20).launch(ssr_mode=False)
|
|
|
|
| 237 |
print(f"DEBUG: Error getting URL params: {e}")
|
| 238 |
return '', '', ''
|
| 239 |
|
| 240 |
+
def auto_search_if_params(repo: str, pr: str, sha: str):
|
| 241 |
+
"""Automatically trigger search if PR is provided"""
|
| 242 |
+
if pr:
|
| 243 |
+
print(f"DEBUG: Auto-triggering search with repo={repo}, pr={pr}, sha={sha}")
|
| 244 |
+
return query(repo, pr, sha)
|
| 245 |
+
else:
|
| 246 |
+
return [], "", "No PR provided - enter parameters and click Search"
|
| 247 |
+
|
| 248 |
search_btn.click(query, inputs=[repo_box, pr_box, sha_box], outputs=[table, json_view, status])
|
| 249 |
refresh_btn.click(refresh_dataset, outputs=status)
|
| 250 |
|
| 251 |
+
# Load URL parameters when page loads, then auto-search if PR is present
|
| 252 |
+
demo.load(get_url_params, outputs=[repo_box, pr_box, sha_box]).then(
|
| 253 |
+
auto_search_if_params,
|
| 254 |
+
inputs=[repo_box, pr_box, sha_box],
|
| 255 |
+
outputs=[table, json_view, status]
|
| 256 |
+
)
|
| 257 |
|
| 258 |
if __name__ == "__main__":
|
| 259 |
demo.queue(max_size=20).launch(ssr_mode=False)
|