only google
This commit is contained in:
parent
ec19628296
commit
eb87a8ae65
16
main.py
16
main.py
|
@ -1,4 +1,4 @@
|
||||||
import whisper
|
#import whisper
|
||||||
import time
|
import time
|
||||||
from google.cloud import speech_v1
|
from google.cloud import speech_v1
|
||||||
from google.cloud.speech_v1 import types
|
from google.cloud.speech_v1 import types
|
||||||
|
@ -16,13 +16,13 @@ class Response(BaseModel):
|
||||||
encoding:str
|
encoding:str
|
||||||
|
|
||||||
|
|
||||||
model = whisper.load_model("medium")
|
#model = whisper.load_model("medium")
|
||||||
@app.post("/voice2txt/")
|
#@app.post("/voice2txt/")
|
||||||
def calculate_api(response: Response):
|
#def calculate_api(response: Response):
|
||||||
path = response.path
|
#path = response.path
|
||||||
t=time.time()
|
#t=time.time()
|
||||||
result = model.transcribe(path)["text"]
|
#result = model.transcribe(path)["text"]
|
||||||
return {"message": result,"time":time.time()-t}
|
#return {"message": result,"time":time.time()-t}
|
||||||
|
|
||||||
|
|
||||||
@app.post("/voice2txtGoogle/")
|
@app.post("/voice2txtGoogle/")
|
||||||
|
|
Loading…
Reference in New Issue