SpireLab commited on
Commit
452b9e6
·
verified ·
1 Parent(s): f15e280

updated code and readme

Browse files
API_Main.py CHANGED
@@ -11,12 +11,12 @@ from fastapi.responses import Response, JSONResponse
11
 
12
 
13
  device = "cuda" if torch.cuda.is_available() else "cpu"
14
- print(f"Using device: {device}")
15
 
16
  MODEL_PATH = "models/best_model.pth"
17
  CONFIG_PATH = "models/config.json"
18
 
19
- print(f"Loading model")
20
  tts = TTS(
21
  model_path=MODEL_PATH,
22
  config_path=CONFIG_PATH,
@@ -65,6 +65,10 @@ languageCODE = {
65
  }
66
 
67
  app = FastAPI()
 
 
 
 
68
  @app.get("/Get_Inference")
69
  async def Inference(text : str, lang : str, speaker : str):
70
 
@@ -99,7 +103,6 @@ def start_server():
99
  "API_Main:app",
100
  host = "0.0.0.0",
101
  port = 8080,
102
- workers = 1,
103
  log_level="debug",
104
  reload=False,
105
  )
 
11
 
12
 
13
  device = "cuda" if torch.cuda.is_available() else "cpu"
14
+ print(f"Using device: {device}", flush = True)
15
 
16
  MODEL_PATH = "models/best_model.pth"
17
  CONFIG_PATH = "models/config.json"
18
 
19
+ print(f"Loading model", flush = True)
20
  tts = TTS(
21
  model_path=MODEL_PATH,
22
  config_path=CONFIG_PATH,
 
65
  }
66
 
67
  app = FastAPI()
68
+ @app.get("/")
69
+ def Is_alive():
70
+ return {"message" : "Server is Live"}
71
+
72
  @app.get("/Get_Inference")
73
  async def Inference(text : str, lang : str, speaker : str):
74
 
 
103
  "API_Main:app",
104
  host = "0.0.0.0",
105
  port = 8080,
 
106
  log_level="debug",
107
  reload=False,
108
  )
Dockerfile CHANGED
@@ -1,27 +1,32 @@
1
- FROM pytorch/pytorch:2.0.1-cuda11.7-cudnn8-runtime
2
 
3
  WORKDIR /app
4
 
5
- RUN python --version
6
 
7
  RUN apt-get update && apt-get install -y \
 
 
 
 
8
  git \
9
- libsndfile1 \
10
- build-essential \
 
11
  && rm -rf /var/lib/apt/lists/*
12
 
13
- RUN pip install --no-cache-dir Cython packaging
 
 
14
 
15
- RUN pip install --no-cache-dir fastapi python-multipart uvicorn
16
 
17
  RUN git clone https://github.com/PranavDBhat/LIMMITS-24-Coquiai.git /app/LIMMITS-24-Coquiai
18
 
19
  RUN cd /app/LIMMITS-24-Coquiai && \
20
- pip install --no-cache-dir -r requirements.txt
21
 
22
  RUN cd /app/LIMMITS-24-Coquiai && \
23
- pip install -e .
24
-
25
- COPY ./ ./
26
 
27
- RUN [ "python", "API_Main.py" ]
 
1
+ FROM ubuntu:22.04
2
 
3
  WORKDIR /app
4
 
5
+ ENV DEBIAN_FRONTEND=noninteractive
6
 
7
  RUN apt-get update && apt-get install -y \
8
+ software-properties-common \
9
+ && add-apt-repository ppa:deadsnakes/ppa \
10
+ && apt-get update \
11
+ && apt-get install -y \
12
  git \
13
+ python3.10 \
14
+ python3.10-dev \
15
+ python3-pip \
16
  && rm -rf /var/lib/apt/lists/*
17
 
18
+ RUN ln -s /usr/bin/python3.10 /usr/bin/python
19
+
20
+ RUN python --version
21
 
22
+ RUN pip3 install --no-cache-dir fastapi python-multipart uvicorn
23
 
24
  RUN git clone https://github.com/PranavDBhat/LIMMITS-24-Coquiai.git /app/LIMMITS-24-Coquiai
25
 
26
  RUN cd /app/LIMMITS-24-Coquiai && \
27
+ pip3 install --no-cache-dir -r requirements.txt
28
 
29
  RUN cd /app/LIMMITS-24-Coquiai && \
30
+ pip3 install -e .
 
 
31
 
32
+ ENTRYPOINT [ "python" ]
README.md CHANGED
@@ -52,7 +52,7 @@ To start the FastAPI server:
52
 
53
  ```bash
54
  docker build -t your_image_name ./
55
- docker run -d -p 8080:8080 your_image_name
56
  ```
57
 
58
  ## Hosting on a GPU
@@ -135,7 +135,7 @@ docker build -t your_image_name .
135
  Start the container with GPU access enabled:
136
 
137
  ```bash
138
- docker run --gpus all -p 8080:8080 your_image_name
139
  ```
140
 
141
  ## Example API Call
@@ -148,9 +148,9 @@ base_url = 'http://localhost:8080/Get_Inference'
148
 
149
  # Set up the query parameters
150
  params = {
151
- 'text': 'Hello world',
152
- 'lang': 'english',
153
- 'speaker': 'english_female'
154
  }
155
 
156
  # Send the GET request
 
52
 
53
  ```bash
54
  docker build -t your_image_name ./
55
+ docker run -d -v /path/to/this/code/dir/:/app/ -p 8080:8080 your_image_name API_main.py
56
  ```
57
 
58
  ## Hosting on a GPU
 
135
  Start the container with GPU access enabled:
136
 
137
  ```bash
138
+ docker run --gpus all -p 8080:8080 -v /path/to/this/code/dir/:/app/ your_image_name API_main.py
139
  ```
140
 
141
  ## Example API Call
 
148
 
149
  # Set up the query parameters
150
  params = {
151
+ 'text': 'ಮಾದರಿಯು ಸರಿಯಾಗಿ ಕಾರ್ಯನಿರ್ವಹಿಸುತ್ತಿದೆಯೇ ಎಂದು ಖಚಿತಪಡಿಸಿಕೊಳ್ಳಲು ಬಳಸಲಾಗುವ ಪರೀಕ್ಷಾ ವಾಕ್ಯ ಇದು.',
152
+ 'lang': 'kannada',
153
+ 'speaker': 'bengali_female'
154
  }
155
 
156
  # Send the GET request
model_related/Bengali_Female/speakers.pth CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:8e148bf409293b45ae4fd27d516232fc7f66068f57ffdab78eeb46fcc56fb843
3
- size 134
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:56f54ff1a806ebe607b0095b489f553546cce0b9904d38c531e78e4a86f09e67
3
+ size 100098080
model_related/Bengali_Male/speakers.pth CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:eab41b51845880320ed1fc60145d91f489cd34e2c62623a113ef3c4f56c3bc70
3
- size 134
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a860399950439f46083e8e6e7e5c057e10cd7994c6232a09b33fd85f0dd1c1cb
3
+ size 119368032
model_related/Bhojpuri_Female/speakers.pth CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:0758d5c58c0c3b2375b876bd3fa319bc9678af9b295d676065b67f93ffd870b8
3
- size 134
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:80b05743e5e5c2d8cc10ac96a7e66006f7ed046fc7c7663f83971607afed31e3
3
+ size 129451808
model_related/Bhojpuri_Male/speakers.pth CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:dd0b455b4f26bb30aa785aa82cb767268df7ecd7687eebedeb5143ff0c45736e
3
- size 134
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:60b03f732526e59e5165fe17c243fdb3338dc69d6b4539cd94009e6152955511
3
+ size 123140960
model_related/Chhattisgarhi_Female/speakers.pth CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:abf3fe4309d65f0f0fbbc2f2b3aff3928482818e32ff69575f50049f27ee6b3d
3
- size 134
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3ab3dc8e3a8946d1a170030f7da2a829441be4a70d9dd9f9689d03360d0bc876
3
+ size 130934816
model_related/Chhattisgarhi_Male/speakers.pth CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:9593a0c877baea24a42f7ab59b49c7a1911e21ad5ba1a5bd1f9f1d736b8ede79
3
- size 134
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:973c6233369aade6066051802d3d8165c9199be7bc0144ea0a4ffee18cb315cc
3
+ size 108560992
model_related/English_Female/speakers.pth CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:d54951c45b4bc40ec0d4aef4adfdd74c3569b1b8ddb7f278f36cf7bb1f0ebfaa
3
- size 134
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ef4b8a8c9e23c9ab0f2e0c053ce85e55b0f3ea34e23dccf2b463502218b7ba1f
3
+ size 113899296
model_related/English_Male/speakers.pth CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:3977b874607e6e96b95870e9abdf92b1729ca913c29142f9a12bf048cf156bda
3
- size 134
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f1a36e7af9cd38a35a70227b25ec4de0ea9cfdf171bf445bec5731abb65eded4
3
+ size 118719648
model_related/Gujarati_Female/speakers.pth CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:4fcfb056e543d6cacebc2fbeee09c7b7dce47073f90b364d2bca4bb74b9c5af9
3
- size 133
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:81e435824571f839e07984422a3528cb6243da654137560df67b03d2858a75b5
3
+ size 35408544
model_related/Gujarati_Male/speakers.pth CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:7175678de9331b704704942edb94b0047d7389594ca8b474e61cc7d9b9340081
3
- size 133
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:315f8348df2662c0d04297df825a02190108ede342b3b2926fb9c83b22cbb3cc
3
+ size 35875360
model_related/Hindi_Female/speakers.pth CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:0830857099353182c42e709b2fe7df2ee590cec4a1fc57549fdc1550ce6a7108
3
- size 134
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d36722d9cfa2714f7682d8cd932182b0ecf71663151131a12db01352c6d32672
3
+ size 103680032
model_related/Hindi_Male/speakers.pth CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:221cd9b955f2fc8adb79675929fe0cc6a49479e774f2e4f160587934fcf3c2e3
3
- size 134
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ea4a7831a9fa5961f56bbab0d97d63df34a8189fad2d5294dee2effc5a4e2f24
3
+ size 116714528
model_related/Kannada_Female/speakers.pth CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:14b146984304ef7a2d653ccaa75cfac547075dee2ee8678074a4a1609f050090
3
- size 133
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:12ac883789029ddab4f2f6cf0340a0ad52210035513ba2a6676f21f6438a4ee3
3
+ size 80812384
model_related/Kannada_Male/speakers.pth CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:e30be0891dea3f5ddd51b2a76c76d5b1e83a6957c21ae1cfd0ada5f9895e12c8
3
- size 133
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2af52780734b88535adff48246df32ca4e5b2cf20f0c9f7efcb849d8f024eba4
3
+ size 97633824
model_related/Magahi_Female/speakers.pth CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:6bc6765fa7972cd5afaee8f60e38c9413797dbb25b240453a04d29fcf87170ef
3
- size 134
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8000b755a4ffd5e6b0a95e2a06dabd02d6f59dbae46776d9a662e214f7f93fb9
3
+ size 145807392
model_related/Magahi_Male/speakers.pth CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:bd4c2775d591ee6d50519c9456cf62026082ed2574fb2321fa47db3a0844b6c4
3
- size 134
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b7a9007a83759fb8f1cd4bcef79a5b083839d09e1703484caa9d727dd5a1bce8
3
+ size 153767712
model_related/Maithili_Female/speakers.pth CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:aa059452f7ff378eb48c086458f6a89bc09d3575ecb4d9b08dd013feff8aa961
3
- size 134
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a4f587283f8604bcc95cba0b6e2320041619b76a715b6b0c4253a584acc595a2
3
+ size 163039520
model_related/Maithili_Male/speakers.pth CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:57519e60ae79d12606e4856facadbdf83d89fc2473127298ba7f7d22b4a0aad7
3
- size 134
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e7f910296937f346e330e06fc5c7c0afcad3f05f252afd3e941711f2557d197b
3
+ size 152221920
model_related/Marathi_Female/speakers.pth CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:1f5af64238bfd96d9d451eead5b119fdfdfee524ef636724e94835b295f9a54c
3
- size 134
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7e67881879aac91f6653e96f559af5129e023e2879f76fa7bc8e24b77a8236b3
3
+ size 103038496
model_related/Marathi_Male/speakers.pth CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:eb72a8ee86e5fb9ecda480028e586e11d856c9cd33b168b479c542df581b4c00
3
- size 133
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7bde8d12edc5745f6c1151f7a0e53bce657a416ad16259a98da14480e330472d
3
+ size 98007520
model_related/Telugu_Female/speakers.pth CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:f8c2542da9e6ff71aa439e85d795fefbc02543fda1f6ac92e4f2a1a1e61bbe21
3
- size 134
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:70be39a4e6967100c91ce142d617d1ee23fbba24bd84141bfc67cc71a3cd6ed8
3
+ size 103993632
model_related/Telugu_Male/speakers.pth CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:510e82da22f608832af21a289709f3b801d6659d7cbd12962bb1743319b145f7
3
- size 134
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b419a9b129289c861f6d2f6d8e0f176e9a245879b5a0c43e5b75ccf0ad9ed93d
3
+ size 101432480
models/best_model.pth CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:96f100ad6435878949e41d458c6c49b401326a8bf4d020fd9cb5aa41b09e4f5d
3
- size 135
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:df50d69a41b53bb81037c4ef8dcb264fb379618c1afc958211ff809dcd4d3080
3
+ size 1043587902
models/config.json CHANGED
@@ -556,7 +556,7 @@
556
  "use_spectral_norm_disriminator": false,
557
  "use_speaker_embedding": false,
558
  "num_speakers": 0,
559
- "speakers_file": "/app/models/speakers.pth",
560
  "d_vector_file": [
561
  "model_related/Bengali_Female/speakers.pth",
562
  "model_related/Chhattisgarhi_Male/speakers.pth",
@@ -588,7 +588,7 @@
588
  "use_language_embedding": true,
589
  "embedded_language_dim": 4,
590
  "num_languages": 11,
591
- "language_ids_file": "/app/models/language_ids.json",
592
  "use_speaker_encoder_as_loss": false,
593
  "speaker_encoder_config_path": "https://github.com/coqui-ai/TTS/releases/download/speaker_encoder_model/config_se.json",
594
  "speaker_encoder_model_path": "https://github.com/coqui-ai/TTS/releases/download/speaker_encoder_model/model_se.pth.tar",
@@ -629,9 +629,9 @@
629
  "r": 1,
630
  "num_speakers": 0,
631
  "use_speaker_embedding": false,
632
- "speakers_file": "/app/models/speakers.pth",
633
  "speaker_embedding_channels": 256,
634
- "language_ids_file": "/app/models/language_ids.json",
635
  "use_language_embedding": true,
636
  "use_d_vector_file": true,
637
  "d_vector_file": [
 
556
  "use_spectral_norm_disriminator": false,
557
  "use_speaker_embedding": false,
558
  "num_speakers": 0,
559
+ "speakers_file": "models/speakers.pth",
560
  "d_vector_file": [
561
  "model_related/Bengali_Female/speakers.pth",
562
  "model_related/Chhattisgarhi_Male/speakers.pth",
 
588
  "use_language_embedding": true,
589
  "embedded_language_dim": 4,
590
  "num_languages": 11,
591
+ "language_ids_file": "models/language_ids.json",
592
  "use_speaker_encoder_as_loss": false,
593
  "speaker_encoder_config_path": "https://github.com/coqui-ai/TTS/releases/download/speaker_encoder_model/config_se.json",
594
  "speaker_encoder_model_path": "https://github.com/coqui-ai/TTS/releases/download/speaker_encoder_model/model_se.pth.tar",
 
629
  "r": 1,
630
  "num_speakers": 0,
631
  "use_speaker_embedding": false,
632
+ "speakers_file": "models/speakers.pth",
633
  "speaker_embedding_channels": 256,
634
+ "language_ids_file": "models/language_ids.json",
635
  "use_language_embedding": true,
636
  "use_d_vector_file": true,
637
  "d_vector_file": [
models/speakers.pth CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:5d56ede16a2fa6a1575002ce54919618748a8280c7ae529ebaf2767505016128
3
- size 129
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7cbdf9efca833df8eb54f7366f8a6a21097b28bea6b1490b11277ea41716a6cc
3
+ size 1312