JacobLinCool Codex commited on
Commit
6ac8ef6
·
verified ·
1 Parent(s): f4e9a2f

fix: add zerogpu entrypoint

Browse files

Co-authored-by: Codex <noreply@openai.com>

Files changed (3) hide show
  1. README.md +4 -0
  2. app.py +25 -1
  3. requirements.txt +1 -0
README.md CHANGED
@@ -56,6 +56,10 @@ If a selected model is unavailable or the user is not signed in, the report
56
  records the reason in model notes and returns the deterministic analysis instead
57
  of failing the whole Space.
58
 
 
 
 
 
59
  ## Agent Session Locations
60
 
61
  ```bash
 
56
  records the reason in model notes and returns the deterministic analysis instead
57
  of failing the whole Space.
58
 
59
+ The Gradio endpoint is decorated with `@spaces.GPU` so the app can run on
60
+ Hugging Face ZeroGPU hardware. The deterministic path still works without model
61
+ weights; ZeroGPU only supplies the runtime contract and queueing surface.
62
+
63
  ## Agent Session Locations
64
 
65
  ```bash
app.py CHANGED
@@ -8,6 +8,7 @@ from pathlib import Path
8
  from typing import Any, Optional
9
 
10
  import gradio as gr
 
11
 
12
  from analyzer import analyze_trace_file
13
  from model_runtime import MODEL_CHOICES
@@ -94,7 +95,7 @@ textarea, input {
94
  """
95
 
96
 
97
- def analyze_trace(
98
  trace_file: Any,
99
  include_user_context: bool = True,
100
  redact_secrets: bool = True,
@@ -136,6 +137,29 @@ def analyze_trace(
136
  return report_markdown, result_json, redacted_file, report_file, json_file
137
 
138
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
139
  def uploaded_path(trace_file: Any) -> Path:
140
  if isinstance(trace_file, (str, Path)):
141
  return Path(trace_file)
 
8
  from typing import Any, Optional
9
 
10
  import gradio as gr
11
+ import spaces
12
 
13
  from analyzer import analyze_trace_file
14
  from model_runtime import MODEL_CHOICES
 
95
  """
96
 
97
 
98
+ def _analyze_trace_impl(
99
  trace_file: Any,
100
  include_user_context: bool = True,
101
  redact_secrets: bool = True,
 
137
  return report_markdown, result_json, redacted_file, report_file, json_file
138
 
139
 
140
+ @spaces.GPU(duration=90)
141
+ def analyze_trace(
142
+ trace_file: Any,
143
+ include_user_context: bool = True,
144
+ redact_secrets: bool = True,
145
+ ignore_tool_calls: bool = True,
146
+ report_style: str = "field_notes",
147
+ analysis_engine: str = "deterministic",
148
+ oauth_token: Optional[gr.OAuthToken] = None,
149
+ ) -> tuple[str, dict[str, Any], str, str, str]:
150
+ """ZeroGPU-visible Gradio endpoint."""
151
+
152
+ return _analyze_trace_impl(
153
+ trace_file=trace_file,
154
+ include_user_context=include_user_context,
155
+ redact_secrets=redact_secrets,
156
+ ignore_tool_calls=ignore_tool_calls,
157
+ report_style=report_style,
158
+ analysis_engine=analysis_engine,
159
+ oauth_token=oauth_token,
160
+ )
161
+
162
+
163
  def uploaded_path(trace_file: Any) -> Path:
164
  if isinstance(trace_file, (str, Path)):
165
  return Path(trace_file)
requirements.txt CHANGED
@@ -1,2 +1,3 @@
1
  gradio[oauth]>=5.50,<6.0
2
  huggingface_hub>=0.30
 
 
1
  gradio[oauth]>=5.50,<6.0
2
  huggingface_hub>=0.30
3
+ spaces>=0.50