Update app.py
Browse files
app.py
CHANGED
|
@@ -1,13 +1,70 @@
|
|
| 1 |
import json
|
| 2 |
import os
|
| 3 |
import re
|
|
|
|
| 4 |
from functools import lru_cache
|
| 5 |
from typing import List, Optional, Tuple, Dict
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
from huggingface_hub import HfApi, hf_hub_download
|
| 9 |
from huggingface_hub.utils import HfHubHTTPError
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
DATASET_ID = os.environ.get(
|
| 12 |
"CIRCLECI_RESULTS_DATASET_ID",
|
| 13 |
"transformers-community/circleci-test-results",
|
|
@@ -363,7 +420,12 @@ def refresh_dataset() -> str:
|
|
| 363 |
return "β
Cleared cached manifest. Data will be reloaded on next search."
|
| 364 |
|
| 365 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 366 |
with gr.Blocks(title="CircleCI Test Results Viewer") as demo:
|
|
|
|
| 367 |
gr.Markdown(
|
| 368 |
"""
|
| 369 |
# π CircleCI Test Results Viewer
|
|
@@ -373,30 +435,39 @@ with gr.Blocks(title="CircleCI Test Results Viewer") as demo:
|
|
| 373 |
**Quick start:** Enter a PR number and click Search to see the latest test failures.
|
| 374 |
"""
|
| 375 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 376 |
|
| 377 |
with gr.Row():
|
| 378 |
-
with gr.Column(
|
| 379 |
repo_box = gr.Textbox(
|
| 380 |
label="Repository",
|
| 381 |
placeholder="huggingface/transformers",
|
| 382 |
-
info="Optional: filter by repository name"
|
| 383 |
)
|
| 384 |
-
with gr.Column(
|
| 385 |
pr_box = gr.Textbox(
|
| 386 |
label="PR Number",
|
| 387 |
placeholder="42240",
|
| 388 |
-
info="Required: PR number to search"
|
| 389 |
)
|
| 390 |
-
with gr.Column(
|
| 391 |
sha_box = gr.Textbox(
|
| 392 |
label="Commit SHA",
|
| 393 |
placeholder="50947fc",
|
| 394 |
-
info="Optional: commit SHA prefix"
|
| 395 |
)
|
| 396 |
|
| 397 |
with gr.Row():
|
| 398 |
-
search_btn = gr.Button("π Search"
|
| 399 |
-
refresh_btn = gr.Button("π Clear Cache"
|
| 400 |
|
| 401 |
status_md = gr.Markdown("")
|
| 402 |
|
|
@@ -428,7 +499,6 @@ with gr.Blocks(title="CircleCI Test Results Viewer") as demo:
|
|
| 428 |
label="Markdown Summary",
|
| 429 |
lines=20,
|
| 430 |
max_lines=30,
|
| 431 |
-
show_copy_button=True,
|
| 432 |
)
|
| 433 |
|
| 434 |
with gr.Tab("π§ͺ Pytest Commands"):
|
|
@@ -526,5 +596,11 @@ with gr.Blocks(title="CircleCI Test Results Viewer") as demo:
|
|
| 526 |
"""
|
| 527 |
)
|
| 528 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 529 |
if __name__ == "__main__":
|
| 530 |
-
|
|
|
|
|
|
|
|
|
| 1 |
import json
|
| 2 |
import os
|
| 3 |
import re
|
| 4 |
+
import sys
|
| 5 |
from functools import lru_cache
|
| 6 |
from typing import List, Optional, Tuple, Dict
|
| 7 |
|
| 8 |
+
print("="*60)
|
| 9 |
+
print("STARTUP: Importing gradio...")
|
| 10 |
+
print("="*60)
|
| 11 |
+
|
| 12 |
import gradio as gr
|
| 13 |
+
|
| 14 |
+
print(f"β Gradio imported successfully")
|
| 15 |
+
print(f"β Gradio version: {gr.__version__}")
|
| 16 |
+
print(f"β Python version: {sys.version}")
|
| 17 |
+
|
| 18 |
from huggingface_hub import HfApi, hf_hub_download
|
| 19 |
from huggingface_hub.utils import HfHubHTTPError
|
| 20 |
|
| 21 |
+
print(f"β HuggingFace Hub imported successfully")
|
| 22 |
+
|
| 23 |
+
# DEBUG: Print version information and inspect available parameters
|
| 24 |
+
print("="*60)
|
| 25 |
+
print("CHECKING AVAILABLE GRADIO PARAMETERS")
|
| 26 |
+
print("="*60)
|
| 27 |
+
|
| 28 |
+
import inspect
|
| 29 |
+
|
| 30 |
+
try:
|
| 31 |
+
blocks_sig = inspect.signature(gr.Blocks.__init__)
|
| 32 |
+
blocks_params = list(blocks_sig.parameters.keys())
|
| 33 |
+
print(f"β gr.Blocks parameters: {blocks_params}")
|
| 34 |
+
print(f" - 'css' supported: {'css' in blocks_params}")
|
| 35 |
+
print(f" - 'title' supported: {'title' in blocks_params}")
|
| 36 |
+
except Exception as e:
|
| 37 |
+
print(f"β Could not inspect gr.Blocks: {e}")
|
| 38 |
+
|
| 39 |
+
try:
|
| 40 |
+
textbox_sig = inspect.signature(gr.Textbox.__init__)
|
| 41 |
+
textbox_params = list(textbox_sig.parameters.keys())
|
| 42 |
+
print(f"β gr.Textbox parameters: {textbox_params}")
|
| 43 |
+
print(f" - 'show_copy_button' supported: {'show_copy_button' in textbox_params}")
|
| 44 |
+
print(f" - 'info' supported: {'info' in textbox_params}")
|
| 45 |
+
except Exception as e:
|
| 46 |
+
print(f"β Could not inspect gr.Textbox: {e}")
|
| 47 |
+
|
| 48 |
+
try:
|
| 49 |
+
button_sig = inspect.signature(gr.Button.__init__)
|
| 50 |
+
button_params = list(button_sig.parameters.keys())
|
| 51 |
+
print(f"β gr.Button parameters: {button_params}")
|
| 52 |
+
print(f" - 'variant' supported: {'variant' in button_params}")
|
| 53 |
+
print(f" - 'scale' supported: {'scale' in button_params}")
|
| 54 |
+
except Exception as e:
|
| 55 |
+
print(f"β Could not inspect gr.Button: {e}")
|
| 56 |
+
|
| 57 |
+
try:
|
| 58 |
+
column_sig = inspect.signature(gr.Column.__init__)
|
| 59 |
+
column_params = list(column_sig.parameters.keys())
|
| 60 |
+
print(f"β gr.Column parameters: {column_params}")
|
| 61 |
+
print(f" - 'scale' supported: {'scale' in column_params}")
|
| 62 |
+
except Exception as e:
|
| 63 |
+
print(f"β Could not inspect gr.Column: {e}")
|
| 64 |
+
|
| 65 |
+
print("="*60)
|
| 66 |
+
print()
|
| 67 |
+
|
| 68 |
DATASET_ID = os.environ.get(
|
| 69 |
"CIRCLECI_RESULTS_DATASET_ID",
|
| 70 |
"transformers-community/circleci-test-results",
|
|
|
|
| 420 |
return "β
Cleared cached manifest. Data will be reloaded on next search."
|
| 421 |
|
| 422 |
|
| 423 |
+
print("="*60)
|
| 424 |
+
print("CREATING GRADIO INTERFACE")
|
| 425 |
+
print("="*60)
|
| 426 |
+
|
| 427 |
with gr.Blocks(title="CircleCI Test Results Viewer") as demo:
|
| 428 |
+
print("β gr.Blocks created successfully")
|
| 429 |
gr.Markdown(
|
| 430 |
"""
|
| 431 |
# π CircleCI Test Results Viewer
|
|
|
|
| 435 |
**Quick start:** Enter a PR number and click Search to see the latest test failures.
|
| 436 |
"""
|
| 437 |
)
|
| 438 |
+
|
| 439 |
+
# Debug info display
|
| 440 |
+
with gr.Accordion("π Debug Information", open=False):
|
| 441 |
+
gr.Markdown(f"""
|
| 442 |
+
**Gradio Version:** `{gr.__version__}`
|
| 443 |
+
|
| 444 |
+
**Python Version:** `{sys.version.split()[0]}`
|
| 445 |
+
|
| 446 |
+
**Dataset ID:** `{DATASET_ID}`
|
| 447 |
+
|
| 448 |
+
**Note:** Check the application logs for detailed parameter availability.
|
| 449 |
+
""")
|
| 450 |
|
| 451 |
with gr.Row():
|
| 452 |
+
with gr.Column():
|
| 453 |
repo_box = gr.Textbox(
|
| 454 |
label="Repository",
|
| 455 |
placeholder="huggingface/transformers",
|
|
|
|
| 456 |
)
|
| 457 |
+
with gr.Column():
|
| 458 |
pr_box = gr.Textbox(
|
| 459 |
label="PR Number",
|
| 460 |
placeholder="42240",
|
|
|
|
| 461 |
)
|
| 462 |
+
with gr.Column():
|
| 463 |
sha_box = gr.Textbox(
|
| 464 |
label="Commit SHA",
|
| 465 |
placeholder="50947fc",
|
|
|
|
| 466 |
)
|
| 467 |
|
| 468 |
with gr.Row():
|
| 469 |
+
search_btn = gr.Button("π Search")
|
| 470 |
+
refresh_btn = gr.Button("π Clear Cache")
|
| 471 |
|
| 472 |
status_md = gr.Markdown("")
|
| 473 |
|
|
|
|
| 499 |
label="Markdown Summary",
|
| 500 |
lines=20,
|
| 501 |
max_lines=30,
|
|
|
|
| 502 |
)
|
| 503 |
|
| 504 |
with gr.Tab("π§ͺ Pytest Commands"):
|
|
|
|
| 596 |
"""
|
| 597 |
)
|
| 598 |
|
| 599 |
+
print("="*60)
|
| 600 |
+
print("β GRADIO INTERFACE CREATED SUCCESSFULLY")
|
| 601 |
+
print("="*60)
|
| 602 |
+
|
| 603 |
if __name__ == "__main__":
|
| 604 |
+
print("Launching app...")
|
| 605 |
+
demo.queue(max_size=20).launch(ssr_mode=False)
|
| 606 |
+
print("β App launched")
|