Spaces:
Runtime error
Runtime error
Jesus Lopez
commited on
Commit
•
7e9f59c
1
Parent(s):
c35cd37
ci: deploy to hf
Browse files- .github/workflows/update_space.yml +30 -0
- .gitignore +1 -0
- .gradio/certificate.pem +31 -0
- README.md +6 -0
- poetry.lock +0 -0
- pyproject.toml +16 -0
- tts_service/app.py +12 -0
- tts_service/cli.py +23 -0
.github/workflows/update_space.yml
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: Run Python script
|
2 |
+
|
3 |
+
on:
|
4 |
+
push:
|
5 |
+
branches:
|
6 |
+
- main
|
7 |
+
|
8 |
+
jobs:
|
9 |
+
build:
|
10 |
+
runs-on: ubuntu-latest
|
11 |
+
|
12 |
+
steps:
|
13 |
+
- name: Checkout
|
14 |
+
uses: actions/checkout@v4
|
15 |
+
|
16 |
+
- name: Install Poetry
|
17 |
+
run: pipx install poetry
|
18 |
+
|
19 |
+
- name: Set up Python
|
20 |
+
uses: actions/setup-python@v5
|
21 |
+
with:
|
22 |
+
python-version: "3.12"
|
23 |
+
cache: "poetry"
|
24 |
+
|
25 |
+
- name: Install Gradio
|
26 |
+
run: |
|
27 |
+
poetry install --only=ci --no-root -q
|
28 |
+
PATH=$(poetry env info --path)/bin:$PATH
|
29 |
+
huggingface-cli login --token ${{ secrets.hf_token }}
|
30 |
+
gradio deploy
|
.gitignore
CHANGED
@@ -2,3 +2,4 @@
|
|
2 |
.venv/
|
3 |
__pycache__/
|
4 |
*.pyc
|
|
|
|
2 |
.venv/
|
3 |
__pycache__/
|
4 |
*.pyc
|
5 |
+
.env
|
.gradio/certificate.pem
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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xq37Z0j4r7g1SgEEzwxA57d
|
30 |
+
emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc=
|
31 |
+
-----END CERTIFICATE-----
|
README.md
CHANGED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: tts-service
|
3 |
+
app_file: tts_service/app.py
|
4 |
+
sdk: gradio
|
5 |
+
sdk_version: 5.6.0
|
6 |
+
---
|
poetry.lock
CHANGED
The diff for this file is too large to render.
See raw diff
|
|
pyproject.toml
CHANGED
@@ -6,9 +6,21 @@ authors = ["Jesus Lopez <jesus@jesusla.com>"]
|
|
6 |
readme = "README.md"
|
7 |
|
8 |
|
|
|
|
|
|
|
|
|
9 |
[tool.poetry.dependencies]
|
10 |
python = "~3.12"
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
[tool.poetry.group.dev.dependencies]
|
13 |
debugpy = "^1.8.9"
|
14 |
ipykernel = "^6.29.5"
|
@@ -46,7 +58,11 @@ select = [
|
|
46 |
|
47 |
[tool.mypy]
|
48 |
strict = true
|
|
|
49 |
|
|
|
|
|
|
|
50 |
|
51 |
[build-system]
|
52 |
requires = ["poetry-core"]
|
|
|
6 |
readme = "README.md"
|
7 |
|
8 |
|
9 |
+
[tool.poetry.scripts]
|
10 |
+
tts-service = "tts_service.cli:main"
|
11 |
+
|
12 |
+
|
13 |
[tool.poetry.dependencies]
|
14 |
python = "~3.12"
|
15 |
|
16 |
+
[tool.poetry.group.cli.dependencies]
|
17 |
+
click = "^8.1.7"
|
18 |
+
click-help-colors = "^0.9.4"
|
19 |
+
|
20 |
+
[tool.poetry.group.ci.dependencies]
|
21 |
+
gradio = "^5.6.0"
|
22 |
+
huggingface-hub = "^0.26.2"
|
23 |
+
|
24 |
[tool.poetry.group.dev.dependencies]
|
25 |
debugpy = "^1.8.9"
|
26 |
ipykernel = "^6.29.5"
|
|
|
58 |
|
59 |
[tool.mypy]
|
60 |
strict = true
|
61 |
+
disallow_untyped_defs = true
|
62 |
|
63 |
+
[[tool.mypy.overrides]]
|
64 |
+
module = ["gradio"]
|
65 |
+
ignore_missing_imports = true
|
66 |
|
67 |
[build-system]
|
68 |
requires = ["poetry-core"]
|
tts_service/app.py
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
def greet(name: str) -> str:
|
4 |
+
return "Hello " + name + "!"
|
5 |
+
|
6 |
+
app = gr.Interface(fn=greet, inputs="textbox", outputs="textbox")
|
7 |
+
|
8 |
+
if __name__ == "__main__":
|
9 |
+
# HF space entry point
|
10 |
+
# https://discuss.huggingface.co/t/python-gradio-web-pages-suddenly-dont-render-properly-on-ipad-browsers/126669
|
11 |
+
# Once this is fixed, remove ssr_mode=False
|
12 |
+
app.launch(ssr_mode=False)
|
tts_service/cli.py
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import click
|
2 |
+
from click_help_colors import HelpColorsGroup
|
3 |
+
|
4 |
+
|
5 |
+
@click.group(
|
6 |
+
cls=HelpColorsGroup,
|
7 |
+
help_headers_color="yellow",
|
8 |
+
help_options_color="green",
|
9 |
+
)
|
10 |
+
def main() -> None:
|
11 |
+
"""TTS Service CLI"""
|
12 |
+
|
13 |
+
|
14 |
+
@main.command()
|
15 |
+
@click.option("--share", is_flag=True, help="Share the service")
|
16 |
+
def serve(share: bool) -> None:
|
17 |
+
"""Start the TTS Service"""
|
18 |
+
from tts_service.app import app
|
19 |
+
app.launch(share=share)
|
20 |
+
|
21 |
+
|
22 |
+
if __name__ == "__main__":
|
23 |
+
main()
|