Update app.py
Browse files
app.py
CHANGED
|
@@ -7,24 +7,33 @@ from fastapi.responses import FileResponse
|
|
| 7 |
#from pyannote.audio import Pipeline
|
| 8 |
|
| 9 |
from transformers import pipeline # le framework de huggingface
|
|
|
|
|
|
|
| 10 |
|
| 11 |
app = FastAPI()
|
| 12 |
|
| 13 |
#pipe_flan = pipeline("text2text-generation", model="google/flan-t5-small")
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
|
|
|
|
|
|
| 17 |
|
| 18 |
#output = pipe_flan(input)
|
| 19 |
#pipeline = Pipeline.from_pretrained("pyannote/speaker-diarization")
|
| 20 |
#pipeline("file.wav")
|
| 21 |
return {"output":"OK"}
|
|
|
|
|
|
|
| 22 |
|
|
|
|
|
|
|
|
|
|
| 23 |
#app.mount("/", StaticFiles(directory="static", html=True), name="static")
|
| 24 |
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
|
| 29 |
|
| 30 |
|
|
|
|
| 7 |
#from pyannote.audio import Pipeline
|
| 8 |
|
| 9 |
from transformers import pipeline # le framework de huggingface
|
| 10 |
+
#from datasets import load_dataset, Audio # ça c'est pour entrainer mon modele
|
| 11 |
+
|
| 12 |
|
| 13 |
app = FastAPI()
|
| 14 |
|
| 15 |
#pipe_flan = pipeline("text2text-generation", model="google/flan-t5-small")
|
| 16 |
+
#deepneurones = pipeline("automatic-speech-recognition")# la liste des pipelines de huggingface est disponible ici :https://huggingface.co/docs/transformers/quicktour. pipeline() telecharge dans un cache local le modele deeplearning
|
| 17 |
+
deepneurones= pipeline("automatic-speech-recognition", model="facebook/wav2vec2-base-960h")
|
| 18 |
+
|
| 19 |
+
@app.get("/healthcheck")
|
| 20 |
+
def healthcheck():
|
| 21 |
|
| 22 |
#output = pipe_flan(input)
|
| 23 |
#pipeline = Pipeline.from_pretrained("pyannote/speaker-diarization")
|
| 24 |
#pipeline("file.wav")
|
| 25 |
return {"output":"OK"}
|
| 26 |
+
@app.get("/en")
|
| 27 |
+
def stt(input):
|
| 28 |
|
| 29 |
+
dataset = load_dataset("PolyAI/minds14", name="en-US", split="train")
|
| 30 |
+
results = deepneurones(input)
|
| 31 |
+
return {"output":results}
|
| 32 |
#app.mount("/", StaticFiles(directory="static", html=True), name="static")
|
| 33 |
|
| 34 |
+
@app.get("/")
|
| 35 |
+
def index() -> FileResponse:
|
| 36 |
+
return FileResponse(path="/index.html", media_type="text/html")
|
| 37 |
|
| 38 |
|
| 39 |
|