ejschwartz commited on
Commit
17c99c0
·
1 Parent(s): e01044d
Files changed (5) hide show
  1. app.py +11 -1
  2. pyproject.toml +1 -0
  3. requirements.in +1 -0
  4. requirements.txt +10 -12
  5. uv.lock +28 -1
app.py CHANGED
@@ -4,9 +4,19 @@ from typing import Any
4
  import frontmatter
5
  import gradio as gr
6
  from gradio_client import Client, handle_file
 
 
 
 
 
7
 
8
  SPACE_URL = "https://ejschwartz-ghidrafunctioncppexporter-space.hf.space/"
9
- client = Client(SPACE_URL)
 
 
 
 
 
10
 
11
 
12
  def _load_intro_text() -> str:
 
4
  import frontmatter
5
  import gradio as gr
6
  from gradio_client import Client, handle_file
7
+ from tenacity import retry, stop_after_attempt, wait_fixed, before_log, after_log
8
+ import logging
9
+
10
+ logging.basicConfig(level=logging.INFO)
11
+ logger = logging.getLogger(__name__)
12
 
13
  SPACE_URL = "https://ejschwartz-ghidrafunctioncppexporter-space.hf.space/"
14
+
15
+ @retry(stop=stop_after_attempt(10), wait=wait_fixed(120), before=before_log(logger, logging.INFO))
16
+ def _connect_client(url: str) -> Client:
17
+ return Client(url)
18
+
19
+ client = _connect_client(SPACE_URL)
20
 
21
 
22
  def _load_intro_text() -> str:
pyproject.toml CHANGED
@@ -7,4 +7,5 @@ requires-python = ">=3.11"
7
  dependencies = [
8
  "gradio-client>=2.1.0",
9
  "python-frontmatter>=1.1.0",
 
10
  ]
 
7
  dependencies = [
8
  "gradio-client>=2.1.0",
9
  "python-frontmatter>=1.1.0",
10
+ "tenacity>=9.1.4",
11
  ]
requirements.in CHANGED
@@ -1,2 +1,3 @@
1
  gradio_client
2
  python-frontmatter
 
 
1
  gradio_client
2
  python-frontmatter
3
+ tenacity
requirements.txt CHANGED
@@ -4,23 +4,23 @@ annotated-doc==0.0.4
4
  # via typer
5
  anyio==4.12.1
6
  # via httpx
7
- certifi==2026.1.4
8
  # via
9
  # httpcore
10
  # httpx
11
  click==8.3.1
12
  # via typer
13
- filelock==3.24.3
14
  # via huggingface-hub
15
  fsspec==2026.2.0
16
  # via
17
  # gradio-client
18
  # huggingface-hub
19
- gradio-client==2.1.0
20
  # via -r requirements.in
21
  h11==0.16.0
22
  # via httpcore
23
- hf-xet==1.3.0
24
  # via huggingface-hub
25
  httpcore==1.0.9
26
  # via httpx
@@ -28,7 +28,7 @@ httpx==0.28.1
28
  # via
29
  # gradio-client
30
  # huggingface-hub
31
- huggingface-hub==1.4.1
32
  # via gradio-client
33
  idna==3.11
34
  # via
@@ -44,23 +44,21 @@ packaging==26.0
44
  # huggingface-hub
45
  pygments==2.19.2
46
  # via rich
 
 
47
  pyyaml==6.0.3
48
  # via
49
  # huggingface-hub
50
  # python-frontmatter
51
- python-frontmatter==1.1.0
52
- # via -r requirements.in
53
  rich==14.3.3
54
  # via typer
55
  shellingham==1.5.4
56
- # via
57
- # huggingface-hub
58
- # typer
59
  tqdm==4.67.3
60
  # via huggingface-hub
61
  typer==0.24.1
62
- # via typer-slim
63
- typer-slim==0.24.0
64
  # via huggingface-hub
65
  typing-extensions==4.15.0
66
  # via
 
4
  # via typer
5
  anyio==4.12.1
6
  # via httpx
7
+ certifi==2026.2.25
8
  # via
9
  # httpcore
10
  # httpx
11
  click==8.3.1
12
  # via typer
13
+ filelock==3.25.1
14
  # via huggingface-hub
15
  fsspec==2026.2.0
16
  # via
17
  # gradio-client
18
  # huggingface-hub
19
+ gradio-client==2.3.0
20
  # via -r requirements.in
21
  h11==0.16.0
22
  # via httpcore
23
+ hf-xet==1.3.2
24
  # via huggingface-hub
25
  httpcore==1.0.9
26
  # via httpx
 
28
  # via
29
  # gradio-client
30
  # huggingface-hub
31
+ huggingface-hub==1.6.0
32
  # via gradio-client
33
  idna==3.11
34
  # via
 
44
  # huggingface-hub
45
  pygments==2.19.2
46
  # via rich
47
+ python-frontmatter==1.1.0
48
+ # via -r requirements.in
49
  pyyaml==6.0.3
50
  # via
51
  # huggingface-hub
52
  # python-frontmatter
 
 
53
  rich==14.3.3
54
  # via typer
55
  shellingham==1.5.4
56
+ # via typer
57
+ tenacity==9.1.4
58
+ # via -r requirements.in
59
  tqdm==4.67.3
60
  # via huggingface-hub
61
  typer==0.24.1
 
 
62
  # via huggingface-hub
63
  typing-extensions==4.15.0
64
  # via
uv.lock CHANGED
@@ -78,10 +78,16 @@ version = "0.1.0"
78
  source = { virtual = "." }
79
  dependencies = [
80
  { name = "gradio-client" },
 
 
81
  ]
82
 
83
  [package.metadata]
84
- requires-dist = [{ name = "gradio-client", specifier = ">=2.1.0" }]
 
 
 
 
85
 
86
  [[package]]
87
  name = "gradio-client"
@@ -234,6 +240,18 @@ wheels = [
234
  { url = "https://files.pythonhosted.org/packages/c7/21/705964c7812476f378728bdf590ca4b771ec72385c533964653c68e86bdc/pygments-2.19.2-py3-none-any.whl", hash = "sha256:86540386c03d588bb81d44bc3928634ff26449851e99741617ecb9037ee5ec0b", size = 1225217, upload-time = "2025-06-21T13:39:07.939Z" },
235
  ]
236
 
 
 
 
 
 
 
 
 
 
 
 
 
237
  [[package]]
238
  name = "pyyaml"
239
  version = "6.0.3"
@@ -311,6 +329,15 @@ wheels = [
311
  { url = "https://files.pythonhosted.org/packages/e0/f9/0595336914c5619e5f28a1fb793285925a8cd4b432c9da0a987836c7f822/shellingham-1.5.4-py2.py3-none-any.whl", hash = "sha256:7ecfff8f2fd72616f7481040475a65b2bf8af90a56c89140852d1120324e8686", size = 9755, upload-time = "2023-10-24T04:13:38.866Z" },
312
  ]
313
 
 
 
 
 
 
 
 
 
 
314
  [[package]]
315
  name = "tqdm"
316
  version = "4.67.3"
 
78
  source = { virtual = "." }
79
  dependencies = [
80
  { name = "gradio-client" },
81
+ { name = "python-frontmatter" },
82
+ { name = "tenacity" },
83
  ]
84
 
85
  [package.metadata]
86
+ requires-dist = [
87
+ { name = "gradio-client", specifier = ">=2.1.0" },
88
+ { name = "python-frontmatter", specifier = ">=1.1.0" },
89
+ { name = "tenacity", specifier = ">=9.1.4" },
90
+ ]
91
 
92
  [[package]]
93
  name = "gradio-client"
 
240
  { url = "https://files.pythonhosted.org/packages/c7/21/705964c7812476f378728bdf590ca4b771ec72385c533964653c68e86bdc/pygments-2.19.2-py3-none-any.whl", hash = "sha256:86540386c03d588bb81d44bc3928634ff26449851e99741617ecb9037ee5ec0b", size = 1225217, upload-time = "2025-06-21T13:39:07.939Z" },
241
  ]
242
 
243
+ [[package]]
244
+ name = "python-frontmatter"
245
+ version = "1.1.0"
246
+ source = { registry = "https://pypi.org/simple" }
247
+ dependencies = [
248
+ { name = "pyyaml" },
249
+ ]
250
+ sdist = { url = "https://files.pythonhosted.org/packages/96/de/910fa208120314a12f9a88ea63e03707261692af782c99283f1a2c8a5e6f/python-frontmatter-1.1.0.tar.gz", hash = "sha256:7118d2bd56af9149625745c58c9b51fb67e8d1294a0c76796dafdc72c36e5f6d", size = 16256, upload-time = "2024-01-16T18:50:04.052Z" }
251
+ wheels = [
252
+ { url = "https://files.pythonhosted.org/packages/49/87/3c8da047b3ec5f99511d1b4d7a5bc72d4b98751c7e78492d14dc736319c5/python_frontmatter-1.1.0-py3-none-any.whl", hash = "sha256:335465556358d9d0e6c98bbeb69b1c969f2a4a21360587b9873bfc3b213407c1", size = 9834, upload-time = "2024-01-16T18:50:00.911Z" },
253
+ ]
254
+
255
  [[package]]
256
  name = "pyyaml"
257
  version = "6.0.3"
 
329
  { url = "https://files.pythonhosted.org/packages/e0/f9/0595336914c5619e5f28a1fb793285925a8cd4b432c9da0a987836c7f822/shellingham-1.5.4-py2.py3-none-any.whl", hash = "sha256:7ecfff8f2fd72616f7481040475a65b2bf8af90a56c89140852d1120324e8686", size = 9755, upload-time = "2023-10-24T04:13:38.866Z" },
330
  ]
331
 
332
+ [[package]]
333
+ name = "tenacity"
334
+ version = "9.1.4"
335
+ source = { registry = "https://pypi.org/simple" }
336
+ sdist = { url = "https://files.pythonhosted.org/packages/47/c6/ee486fd809e357697ee8a44d3d69222b344920433d3b6666ccd9b374630c/tenacity-9.1.4.tar.gz", hash = "sha256:adb31d4c263f2bd041081ab33b498309a57c77f9acf2db65aadf0898179cf93a", size = 49413, upload-time = "2026-02-07T10:45:33.841Z" }
337
+ wheels = [
338
+ { url = "https://files.pythonhosted.org/packages/d7/c1/eb8f9debc45d3b7918a32ab756658a0904732f75e555402972246b0b8e71/tenacity-9.1.4-py3-none-any.whl", hash = "sha256:6095a360c919085f28c6527de529e76a06ad89b23659fa881ae0649b867a9d55", size = 28926, upload-time = "2026-02-07T10:45:32.24Z" },
339
+ ]
340
+
341
  [[package]]
342
  name = "tqdm"
343
  version = "4.67.3"