From 7c395f6cd9e4c9b9d2bedadb0ac0704cf8bf797f Mon Sep 17 00:00:00 2001 From: JJneid Date: Mon, 5 Dec 2022 18:57:18 -0500 Subject: [PATCH 1/5] updated sdk with service_provider --- .DS_Store | Bin 6148 -> 6148 bytes README.md | 57 +++++++++++++++++- SDK_v1/.DS_Store | Bin 6148 -> 6148 bytes .../__pycache__/speechtotext.cpython-310.pyc | Bin 2164 -> 0 bytes SDK_v1/readme.md | 44 -------------- SDK_v1/speechtotext.py | 45 +++++++------- SDK_v1/test_speechtotext.py | 51 ---------------- SDK_v1/test_speechtotext_1.py | 26 ++++++++ 8 files changed, 102 insertions(+), 121 deletions(-) delete mode 100644 SDK_v1/__pycache__/speechtotext.cpython-310.pyc delete mode 100644 SDK_v1/readme.md delete mode 100644 SDK_v1/test_speechtotext.py create mode 100644 SDK_v1/test_speechtotext_1.py diff --git a/.DS_Store b/.DS_Store index ed35149ac416aee35c903e918e5c52136a4d9362..2325bfd137234716d35b6bb8ad53d89cb54b89e7 100644 GIT binary patch delta 56 zcmZoMXfc@J&&atkU^g=(=VTt1_{nowc8VBTn&~K*n%C+mR2v#v8tEulSeS3lVx7x0 MvB79FJI7ys0L)nsO#lD@ delta 89 zcmZoMXfc@J&&ahgU^g=(*JK`+cx6t8AO=?kM+O%LUm&f=kjs$bnUkNKl#`#tz`!5? q#Oo)=u$&MvwlvmJFf*vtQK&XFG_=%Fu&^-MY{5F0X)`;=Uw#0lj}=+~ diff --git a/README.md b/README.md index 05012b9..8e44ce8 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,56 @@ -# slashml-python-client +# SLASHML Python client -to be updated to guide users +This is a Python client for SLASHML. It lets you run transcription jobs from your Python code or Jupyter notebook. + +Grab your token from [https://www.slashml.com/dashboard/](>settings> new api key) and authenticate by setting it as an environment variable (or when you initialize the service, see examples): +``` +export SLASHML_API_KEY=[token] +``` + +-- update from this part, include examples, sign up, token, service providers, type of servies, benchmarking, link to pricing, Tutorial examples/examples + + +SDK for SlashML documentation: +- methods: upload_audio, transcribe, status + +Steps to Integrate +1 - (Optional) Upload files where the data points to your audio file +``` +# call the class +speect_to_text = speechtotext.SpeechToText() +file_location="path/to/your/file.mp3" +# when +API_KEY="SLASH_ML_API_KEY" +model_choice="assembly" +result_upload = speect_to_text.upload_audio(file_location,API_KEY, model_choice) +print(result_upload) +``` +Save the upload_url. You can use this url link in the rest of the calls. + + +2- Submit your audio file for transcription +``` +upload_url=upload_url # you can skip step 1 and just input the accessible link of your # file) + +result_transcribe = speect_to_text.transcribe(upload_url,API_KEY, model_choice) + +print(result_transcribe) +``` +Save the id in the response object. + + +3 - Check the status and get the text result of the transcription +``` +job_id= id +result_status = speect_to_text.status(job_id,API_KEY, model_choice=model_choice) + +### get the full details of the result +print(result_status) +### get the text reulst only +print(json.loads(result)["text"]) +``` + + +et voilĂ , Next steps: +- pip install slashml +- add SLASH_API_KEY to sys path diff --git a/SDK_v1/.DS_Store b/SDK_v1/.DS_Store index e6517a46c43905e5e3a4d765057fe5c26cf4217a..7b0d0f2ad4b05c23c8a3da418a37e57beda80ace 100644 GIT binary patch delta 138 zcmZoMXfc=|#>B`mu~2NHo}wr-0|Nsi1A_nqLo!1KLkUAZ5T{NoT+RxT;Gg`DRcG=e z)<{ON$zNENCF2N`~Uy| delta 517 zcmZoMXfc=|#>B!ku~2NHo}wr_0|Nsi1A_nqLn=ctLkUAXLo!3+=7)^Snd?DPybO8_ z1q_uy2_$Ktk_?7a&z$_^q@4UDpemqlrgR{!_a6*^ECvQ{pi%K)y+8vYIzS?*x)^`r z)>V(JEvdY?0BYHeq=KBx;t~UcYm7|HEUawo9PAw29I?R}`Q^bSi6y1QPKia)AYMp* zeohjMotPAsnOYt%AmW^#SCW{Sms$kYkeQMSR1y=OnU|7Z?v!7emr@MY8=RR^50c^F zxqpRo1r-iqFo;&CBls`Q>g!J5#Qcw^sX%WMT!o9yhuYKxtN)g^X* zVf6xQ!|F1tfgSJYMsLFTVA#+5{3kUFhDuH3^)QSl$(l@KIUJ{JgM1vyQtGP8uPTrW zA77jK;dGMbF$-snP>DE`1Ci|UaJF>JO;nO+0|FM$8_sR$cc9A_5M_+aUjc@qq`%vs z66wA+!+;2s)2-fCr+4?k7VY&r{oNkj-PsC=wk1#ZHA&bjL)1X*_3dz1av{Ub&5S23 zT<7wk$|qqD4S0}-+fURm&*+^r;h741>-Xv7YeyET9PL?~JkkD*G#>A<_~sc@4mE8V zvkRxuS({5}@9sutePgGmUBT5yCT3w!2rsbI>gr}Z z1=U0{ixI16d2ViJ`yRc&@nc|Xl1uIJ>~SLUOj`$Bi3Xe)n8Jghw7w!3_u8j4$r45B zGH|60ZSxHq<`TNOpQN0o`JlX7dq-F5#yDp@rGsIf4EO-;m^XwP1G)6xCQO+5!YII| zLz|JpPRv7xS%n3oiwUE^tIT~$n7423lLPb6Q)FZn#>g(5!Yw@JKerG4!XG(+MXmd~ z*3TdE?DEgw9Ev44Tsx&AkrPi@lFybDmx`A2wejRzO~l@;Ub5kM!VdyVdqW;Ghyrc1 zSjE~w`()s1cRv^7SZO<-@J#!HKbpc(AU4URI*G8|?X4d=>lk6$#+V3d6~yO27jYiR zg;FbpT8fJ}_a^ZZOabvOa&U502Hx~aqe_%Yd5n6A$JH(0^vxEr|MneX+NS%LYt1e$ z#M|k8x_-n>MfxwVIB;I+l^Za@YyuyEPma8UUUASXg;_vx`Hg@l%n<=kSfwAF=T_+l z%s#gp)k;(;+#@h}OJ@WmYE}1hR@qVhUxoj#NC}3x1oOZV@8OmYkbDS4x91Vv-|2LF zcXsY=_Yq?85lSB+{259gBOJBn)nuaRk+a0dD1w-aD@Z;;g5h{7_UrR)dmN?Z3J{;v z0b@c4pxbg>bGEvG@5v7Bj`BU4umxn{0Wpq|{SKJ_j`s@B7gk}uG%>oF4VZd`H$qIE z?g@|rArqeiS-|QnEa>;&g4Idgt042Mp!^a~Ifm^2z~f34tEmiOqr?h=z}OIcZG`3A z0xXpzl;9@Fb%PZwD_K0|lQA&XSN?XVw^6$IGVB&#Ai<&` zzCwaGLw+U$rI#s>yvmr%hm8ufh{cBxbN0rpcbLa2<=?+irump|biWmUf8> LGz`410r~q6S55zo diff --git a/SDK_v1/readme.md b/SDK_v1/readme.md deleted file mode 100644 index 7321fe1..0000000 --- a/SDK_v1/readme.md +++ /dev/null @@ -1,44 +0,0 @@ -SDK for SlashML documentation: -- methods: upload_audio, transcribe, status - -Steps to Integrate -1 - (Optional) Upload files where the data points to your audio file -``` -# call the class -speect_to_text = speechtotext.SpeechToText() -file_location="path/to/your/file.mp3" -# when -API_KEY="SLASH_ML_API_KEY" -model_choice="assembly" -result_upload = speect_to_text.upload_audio(file_location,API_KEY, model_choice) -print(result_upload) -``` -Save the upload_url. You can use this url link in the rest of the calls. - - -2- Submit your audio file for transcription -``` -upload_url=upload_url # you can skip step 1 and just input the accessible link of your # file) - -result_transcribe = speect_to_text.transcribe(upload_url,API_KEY, model_choice) - -print(result_transcribe) -``` -Save the id in the response object. - - -3 - Check the status and get the text result of the transcription -``` -job_id= id -result_status = speect_to_text.status(job_id,API_KEY, model_choice=model_choice) - -### get the full details of the result -print(result_status) -### get the text reulst only -print(json.loads(result)["text"]) -``` - - -et voilĂ , Next steps: -- pip install slashml -- add SLASH_API_KEY to sys path diff --git a/SDK_v1/speechtotext.py b/SDK_v1/speechtotext.py index fc96cbe..3da35e2 100644 --- a/SDK_v1/speechtotext.py +++ b/SDK_v1/speechtotext.py @@ -2,9 +2,10 @@ import requests import os from pathlib import Path +import json class SpeechToText: - # TODO: make sure this is dynamic + SLASHML_BASE_URL = 'https://api.slashml.com/speech-to-text/v1' SLASHML_UPLOAD_URL = SLASHML_BASE_URL+'/upload/' SLASHML_TRANSCRIPT_URL = SLASHML_BASE_URL+'/transcribe/' @@ -13,46 +14,42 @@ class SpeechToText: HEADERS:dict = {} ## add the api key to sys path envs - def __init__(self) -> None: - self.HEADERS = {'authorization': os.environ.get('SLASHML_API_KEY')} + def __init__(self,SLASHML_API_KEY) -> None: + self.HEADERS = {'authorization': os.environ.get('SLASHML_API_KEY')}, + self.API_KEY=SLASHML_API_KEY - def upload_audio(self, file_location:str, API_KEY: str, model_choice: str ): - # here we can also add the service? assemblyai, aws, gcp? + def upload_audio(self, file_location:str): - token="Token {0}".format(API_KEY) + token="Token {0}".format(self.API_KEY) headers = {'authorization': token} - payload = { 'model':model_choice } + files=[ ('audio',('test_audio.mp3',open(file_location,'rb'),'audio/mpeg')) ] - #import pdb - #pdb.set_trace() response = requests.post(self.SLASHML_UPLOAD_URL, - headers=headers, - data=payload,files=files) - return response.text + headers=headers,files=files) + + return json.loads(response.text)["upload_url"] + + def transcribe(self,upload_url:str, service_provider: str ): - def transcribe(self,upload_url:str, API_KEY: str, model_choice: str ): - # here we can add more model params transcript_request = {'audio_url': upload_url} - token="Token {0}".format(API_KEY) + token="Token {0}".format(self.API_KEY) headers = {'authorization': token} payload = { "uploaded_audio_url": upload_url, - "model": model_choice + "service_provider": service_provider } - response = requests.post(self.SLASHML_TRANSCRIPT_URL, headers=headers, data=payload) - return response.text + return json.loads(response.text)["id"] - def status(self,job_id:str, API_KEY: str, model_choice: str ): - token="Token {0}".format(API_KEY) + def status(self,job_id:str, service_provider: str ): + token="Token {0}".format(self.API_KEY) headers = {'authorization': token} payload = { - "model": model_choice + "service_provider": service_provider } - #import pdb - # pdb.set_trace() + response = requests.get(self.SLASHML_TRANSCRIPT_STATUS_URL(job_id) , headers=headers, data=payload) - return response.text + return json.loads(response.text) diff --git a/SDK_v1/test_speechtotext.py b/SDK_v1/test_speechtotext.py deleted file mode 100644 index 34bd9c6..0000000 --- a/SDK_v1/test_speechtotext.py +++ /dev/null @@ -1,51 +0,0 @@ -#### unit testing -import pytest - -import json -def test_upload(): - import speechtotext - # given: there is a local file - speect_to_text = speechtotext.SpeechToText() - file_location="/Users/JJneid/Desktop/SlashMl/s2t_experiments/api_tests/test_audio_1.mp3" - # when - API_KEY="1bd15e1c161ff6d4db2ea1d661d7468b4fa61ca9" - model_choice="assembly" - result = speect_to_text.upload_audio(file_location,API_KEY, model_choice) - print(result) - # then - # assert result== 'https://api.slashml.com/v1/speech-to-text/upload' - -def test_transcribe(): - import speechtotext - # given: there is a local file - speect_to_text = speechtotext.SpeechToText() - upload_url="https://cdn.assemblyai.com/upload/f973cc7a-45f8-47b9-8ebc-20bd2f63a2bd" - # when - API_KEY="1bd15e1c161ff6d4db2ea1d661d7468b4fa61ca9" - model_choice="assembly" - result = speect_to_text.transcribe(upload_url,API_KEY, model_choice) - - print(result) - -def test_status(): - import speechtotext - # given: there is a local file - speect_to_text = speechtotext.SpeechToText() - upload_url="https://cdn.assemblyai.com/upload/28313e17-9a51-43cd-a29f-68dedd772f83" - # when - job_id= "r4ff9gd76c-530e-4e27-bed4-ce12b63b26b0" - API_KEY="1bd15e1c161ff6d4db2ea1d661d7468b4fa61ca9" - model_choice="assembly" - result = speect_to_text.status(job_id,API_KEY, model_choice=model_choice) - - print(json.loads(result)["text"]) - -test_upload() -#test_transcribe() -#test_status() -# API_KEY="1bd15e1c161ff6d4db2ea1d661d7468b4fa61ca9" -# token="Token {api}".format(api=API_KEY) -# print(token) - -# headers = {'authorization': token} -# print(headers) \ No newline at end of file diff --git a/SDK_v1/test_speechtotext_1.py b/SDK_v1/test_speechtotext_1.py new file mode 100644 index 0000000..954596c --- /dev/null +++ b/SDK_v1/test_speechtotext_1.py @@ -0,0 +1,26 @@ +import speechtotext + +#initialize SLASHML +API_KEY="1bd15e1c161ff6d4db2ea1d661d7468b4fa61ca9" +speect_to_text = speechtotext.SpeechToText(API_KEY) +# optional local file to upload, if not an accessible url +file_location="/Users/JJneid/Desktop/SlashMl/s2t_experiments/api_tests/test_audio_1.mp3" + +###################################################### +# If your audio files aren't accessible via a URL already, you can upload your audio file using this API +upload_url= speect_to_text.upload_audio(file_location) + +# choose your service provider: "asemblyai", "aws", "whisper" +service_provider="assembly" +# transcribe +transcribe_id= speect_to_text.transcribe(upload_url,service_provider) +# get the status, the result will be out after the job is done, so we wait a bit :) +status=speect_to_text.status(transcribe_id,service_provider=service_provider) + +# get the text result +## assembly: status["text"] +## whisper: status["transcription_data"]["transcription"] +## aws: retreive result from json file link + +print(status["text"]) + From 31879f6cb5e6d6749d65cb4d1337ee629d123fe0 Mon Sep 17 00:00:00 2001 From: JJneid Date: Mon, 5 Dec 2022 19:02:30 -0500 Subject: [PATCH 2/5] removed unnecessary files --- .DS_Store | Bin 6148 -> 0 bytes .gitignore | 2 -- README.md | 2 +- 3 files changed, 1 insertion(+), 3 deletions(-) delete mode 100644 .DS_Store delete mode 100644 .gitignore diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 2325bfd137234716d35b6bb8ad53d89cb54b89e7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK%}V4z5U$p!J<3833SNZ3UI#V8`hyX@aO2kE&h!DrLpb^7>Vc=~uK;NzftI&ZM^6K}?R?xP3FGVIXU;3eM2T~BwgZ4zs z?L^Eh1mMFlG~pWDsxR!n!qyXOlZ zBwv%JVZbo(?+noS;GhzE8ViN;=)gvn0EiY&OToVU^+$AQ0@2f0D8v~Qra}=_DAOed z)0G2L;b`}?f1yx?1Cu-BI(lcOD-@;+59UaBV4gzL8U_plRR*Tj(5CzU@cH_`8e~R> z0mHz%Vt`qG;5RTOeYZYJj_z6q^&FLi{0fCK1RH%F%MM+|%cxS&=1>RG(^x3P85Hv) NAZaj-Vc@?q@Blo%ij4pO diff --git a/.gitignore b/.gitignore deleted file mode 100644 index fde543a..0000000 --- a/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -.DS_Store -services.py diff --git a/README.md b/README.md index 8e44ce8..ff36137 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ This is a Python client for SLASHML. It lets you run transcription jobs from your Python code or Jupyter notebook. -Grab your token from [https://www.slashml.com/dashboard/](>settings> new api key) and authenticate by setting it as an environment variable (or when you initialize the service, see examples): +Grab your token from [https://www.slashml.com/dashboard] (>settings> new api key) and authenticate by setting it as an environment variable (or when you initialize the service, see examples): ``` export SLASHML_API_KEY=[token] ``` From b207443d661a86df48d51fce2470713568748c89 Mon Sep 17 00:00:00 2001 From: JJneid Date: Mon, 5 Dec 2022 19:05:18 -0500 Subject: [PATCH 3/5] removed unnecessary files 2 --- SDK_v1/.DS_Store | Bin 6148 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 SDK_v1/.DS_Store diff --git a/SDK_v1/.DS_Store b/SDK_v1/.DS_Store deleted file mode 100644 index 7b0d0f2ad4b05c23c8a3da418a37e57beda80ace..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKK}thG3{A9)f(yG4aU;wL3cbOn)P-vgP-!i=D14y`?QTxu6+EK8mqf937P=9U z1d^A|B>6KBIx`Uwoj%=7L`EVqgc6lbLpa==I*Q<9pjwTk+{>f%&{d<*UmW7vPh}$y zSn*0euYZeOj4{5uUiZtzx?doYG`&E_uO{$B&TO|E*!fTD=;cA3^KaCd%cQj?eLkqg zb)_T&$v`rY3?u_>25@Inh9{0`lYwL)8Tep;=R<)KyTIybM+c0x0Kfr;P2ls9%$yR~ z1y)DQK-5!#o~qGesHbDRL|hkG9X(w%nh%XHzc(*xUq}67;i8>m+GHRZ*k^#fFJ#2~ z{|bMZW|MCrX_A3t;J-4UgW1h&irvNC`emQIYYX%iN?}~31A)Ky2*3}XBNsO5^MyX* Xy1?qlDjc_TU_JzlkTl7_FEH>1pMgRT From 0c2f7ece3bb81e4e1034c2fd4d05e95dd160febb Mon Sep 17 00:00:00 2001 From: JJneid Date: Fri, 23 Dec 2022 18:27:21 -0500 Subject: [PATCH 4/5] new update with response succeess/failed --- .DS_Store | Bin 0 -> 6148 bytes README.md | 20 ++++- SDK_v1/speechtotext.py | 55 -------------- SDK_v1/test_speechtotext_1.py | 26 ------- src/.DS_Store | Bin 0 -> 6148 bytes src/__pycache__/speechtotext.cpython-310.pyc | Bin 0 -> 2370 bytes src/requirements.txt | 1 + src/speechtotext.py | 75 +++++++++++++++++++ src/status_test.py | 24 ++++++ src/test_speechtotext_1.py | 21 ++++++ 10 files changed, 140 insertions(+), 82 deletions(-) create mode 100644 .DS_Store delete mode 100644 SDK_v1/speechtotext.py delete mode 100644 SDK_v1/test_speechtotext_1.py create mode 100644 src/.DS_Store create mode 100644 src/__pycache__/speechtotext.cpython-310.pyc create mode 100644 src/requirements.txt create mode 100644 src/speechtotext.py create mode 100644 src/status_test.py create mode 100644 src/test_speechtotext_1.py diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..af188f0cf49af122d49268d34401af48cc2587ca GIT binary patch literal 6148 zcmeHKO>fgc5S>i|U8_R!0i<3kS>jrSga8tv2a|>aSB&VPRKbp;)WY^!u|p0~B%j+K z(<>)V{04pv63p&SXx*jeNYT*Q3<7XTzSjV%Ye8%*bQyJjtl zXr9n>yiL_4N>zkoJt5n_uYi7b9q7Ug5~!NbPwZl@`^%VFhy!z&LI^Qrh+XXCCIil| zFxpTeXL6D&;Kc#0(-50gAr%b{B2acQ`LO-M&NV|Qn@>JJ8c-m~Yu z^`5tS`Lu`r;Kh3F$VZQ#ym~kOoMyQ?H9CO6x82wS!VR3ELu*cF{a~W9Vw1YaWNI{` zbxQZ={smf1eVgyZCDx#$dI${VqIS5O~ zyifJDMN0=^u8i~0l?9zp1RXqtXUakN7P)5ySb?SjZ98=J{{QCo^M8}XBUXSF_^%WY zol!6v;*w}@y|y^L*Lv7KVbiATYKwm;=$Ne-YxP#VgUuMmJ?$X+gtbMCpz)7@k%2o_ I;IAt18xH-2lmGw# literal 0 HcmV?d00001 diff --git a/README.md b/README.md index ff36137..49da84b 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,28 @@ # SLASHML Python client -This is a Python client for SLASHML. It lets you run transcription jobs from your Python code or Jupyter notebook. +This is a Python client for SLASHML. It lets you run transcription jobs from your Python code or Jupyter notebook. Do a transcription job with three lines of code +``` +import speechtotext + +speect_to_text = speechtotext.SpeechToText() +transcribe_id= speect_to_text.transcribe(audio_url,service_provider="aws") +status=speect_to_text.status(transcribe_id,service_provider=service_provider) + +``` +There is a daily limit (throttling) on the number of calls the user performs, transcription jobs can be done without specifying a token (API key). If the user intends on using the service more frequently, it is recommended to generate an token or API key from the dashboard @ [Slashml.com](https://www.slashml.com/). Grab your token from [https://www.slashml.com/dashboard] (>settings> new api key) and authenticate by setting it as an environment variable (or when you initialize the service, see examples): ``` export SLASHML_API_KEY=[token] +``` +or including it in your code as follows: +``` +import speechtotext +API_KEY="your_api_key" +speect_to_text = speechtotext.SpeechToText(API_KEY) +transcribe_id= speect_to_text.transcribe(audio_url,service_provider="aws") +status=speect_to_text.status(transcribe_id,service_provider=service_provider) + ``` -- update from this part, include examples, sign up, token, service providers, type of servies, benchmarking, link to pricing, Tutorial examples/examples diff --git a/SDK_v1/speechtotext.py b/SDK_v1/speechtotext.py deleted file mode 100644 index 3da35e2..0000000 --- a/SDK_v1/speechtotext.py +++ /dev/null @@ -1,55 +0,0 @@ -from django.http import JsonResponse -import requests -import os -from pathlib import Path -import json - -class SpeechToText: - - SLASHML_BASE_URL = 'https://api.slashml.com/speech-to-text/v1' - SLASHML_UPLOAD_URL = SLASHML_BASE_URL+'/upload/' - SLASHML_TRANSCRIPT_URL = SLASHML_BASE_URL+'/transcribe/' - SLASHML_STATUS_URL = SLASHML_BASE_URL+'/transcription' - SLASHML_TRANSCRIPT_STATUS_URL = lambda self,id: f"{SpeechToText.SLASHML_STATUS_URL}/{id}/" - - HEADERS:dict = {} - ## add the api key to sys path envs - def __init__(self,SLASHML_API_KEY) -> None: - self.HEADERS = {'authorization': os.environ.get('SLASHML_API_KEY')}, - self.API_KEY=SLASHML_API_KEY - - def upload_audio(self, file_location:str): - - token="Token {0}".format(self.API_KEY) - headers = {'authorization': token} - - files=[ - ('audio',('test_audio.mp3',open(file_location,'rb'),'audio/mpeg')) - ] - response = requests.post(self.SLASHML_UPLOAD_URL, - headers=headers,files=files) - - return json.loads(response.text)["upload_url"] - - def transcribe(self,upload_url:str, service_provider: str ): - - transcript_request = {'audio_url': upload_url} - token="Token {0}".format(self.API_KEY) - headers = {'authorization': token} - payload = { - "uploaded_audio_url": upload_url, - "service_provider": service_provider - } - response = requests.post(self.SLASHML_TRANSCRIPT_URL, headers=headers, data=payload) - return json.loads(response.text)["id"] - - def status(self,job_id:str, service_provider: str ): - token="Token {0}".format(self.API_KEY) - headers = {'authorization': token} - payload = { - "service_provider": service_provider - } - - response = requests.get(self.SLASHML_TRANSCRIPT_STATUS_URL(job_id) , headers=headers, data=payload) - return json.loads(response.text) - diff --git a/SDK_v1/test_speechtotext_1.py b/SDK_v1/test_speechtotext_1.py deleted file mode 100644 index 954596c..0000000 --- a/SDK_v1/test_speechtotext_1.py +++ /dev/null @@ -1,26 +0,0 @@ -import speechtotext - -#initialize SLASHML -API_KEY="1bd15e1c161ff6d4db2ea1d661d7468b4fa61ca9" -speect_to_text = speechtotext.SpeechToText(API_KEY) -# optional local file to upload, if not an accessible url -file_location="/Users/JJneid/Desktop/SlashMl/s2t_experiments/api_tests/test_audio_1.mp3" - -###################################################### -# If your audio files aren't accessible via a URL already, you can upload your audio file using this API -upload_url= speect_to_text.upload_audio(file_location) - -# choose your service provider: "asemblyai", "aws", "whisper" -service_provider="assembly" -# transcribe -transcribe_id= speect_to_text.transcribe(upload_url,service_provider) -# get the status, the result will be out after the job is done, so we wait a bit :) -status=speect_to_text.status(transcribe_id,service_provider=service_provider) - -# get the text result -## assembly: status["text"] -## whisper: status["transcription_data"]["transcription"] -## aws: retreive result from json file link - -print(status["text"]) - diff --git a/src/.DS_Store b/src/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..e8761022318047b0f6d07fa02adb2f70ac5e342c GIT binary patch literal 6148 zcmeHK%SuB*3{A9)f(yG6m$P$M=^qTGE?oNomDYlb!WF8}?&gpDL_H^o(u>!nB9cII zax;_6%z--(5z+a}!%So%B4a2~=?nYlQsDEFOe}#lusNayqMi!$ zRE;NwdOG4I`qjYZ=;@+1GU~+0ACDKc(Gf4!U9>u;O$L&IJ_D!zIpO(#gI{Lwk>5|r zuVf$@_-730XmPigV^MLoepw#R+5)|YQrNH2fxz!w0`S3og#< O=0(5=Ns|ox0t4@ig)gxH literal 0 HcmV?d00001 diff --git a/src/__pycache__/speechtotext.cpython-310.pyc b/src/__pycache__/speechtotext.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..44b34fe6f7e03c17d2880028445e050ee1594a76 GIT binary patch literal 2370 zcmZuz&2QX96!(nB_I@VYZJSV_bP-Uo5{*HXI8;^X(ggaEI??V1gb!HG&Lr!N*LKIV z5m~%kT5;pX4UkfC>VLu!arBi_@0@yQc{9%Dqw1{Y&Ac~nX5Ra~H_sc_>lF>!-#`61 z_y=bHO6GLafw>Jm{Tv9@C<-;V7?F#B#~~i;u8s;Bamm*j)hT(RQSunO21PxsZ9Ip) zn$t!(+4RM5Ai2}c0OmII^k*PUljpj43+{4trc=DExdcWXMgv9yqe%^FKG9q&(A*L$ zvkJ9tYIKQ~S#<}~3avgd+#2vT#n<&!q}(w zv}OzLN9lkE+svLW9CL{X;%I=u+j*070{ss3vAc@NgUJL9ADPui}0q%fgcrg>V1_&JIW!PBQ`hAGZ)fIyC^*3*POB8LXm zpCaBqna^~k57O85)rnY`kbFp{q)a|%TJFbtENcDu>CCPB6Y!V^Q(uN4U!0?OWbf2= z;#LP#K52;|2E6Ef(zu z9InuJnaGWV2a#wKZo<0S;Tl33T*IHxAf7G&Fv3&wm2q<2#e92OQLH^q*e;}| zHDo@8RLl)&TbfsjN8(L**ftB?NSv@JFLCy00;i=pN#azTWct?T`bK9}W_nIWX&k{e z1*ZfjH;d!>MPT@nl)yP@5=W5!@+F*twsv&0GVcnkr3*kz)WqafNhipBRm0OuXHxw1 z4!$f;Z@{_x!GL)QkM{#`Y#`Hn-sFwPAgjs=&;|gg0^7(?28sSVo|yuTFv#@G$V{pO zz*c4*5&)PefDOkjD>D^L*liYuFj_z@rMv}qJ;TcJoKRo*+yY74P?+*dFz0Ur$(QE2 z-tTst-kt8f&A!Bvzbmy%1(eb?bs)bCGq*V}Uy1OJqEg&rCH{ddar`~G;Wd0K^IhBQ zV^~(`mavI1#>jlxB#^etXV5*-&&^T1?FIAb>LZz4)1%!vXtRET4 z42l6pGc!ko>U)@9$xM~804OyisA|Q8m8;Y`;!40>qvf7PE0EPyr-0ynxa#>|Ku+TT zRl}1YyY;!%s+b4AB2Al?osE9$tBoyZHTX~Rwcc9yo3(Cht=rw`PU~CF183t~r(lng zz6j7cxFx^*h5(&Zcek1fUrbVO5JR@9pjk!GuEOS%pcOCRLn(VxaLnSA>#&~6X986P z(te3l^aiS6s4&opK0SXXK*gRma@q}9m?D47JTI?!-Z-WcC^TMP^SnnBKP*<<#@v%H zJH0iPWba6OK9EF4lFPg}dh;|Gh Date: Fri, 23 Dec 2022 18:30:35 -0500 Subject: [PATCH 5/5] new update with response --- .DS_Store | Bin 6148 -> 0 bytes src/.DS_Store | Bin 6148 -> 0 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 .DS_Store delete mode 100644 src/.DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index af188f0cf49af122d49268d34401af48cc2587ca..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKO>fgc5S>i|U8_R!0i<3kS>jrSga8tv2a|>aSB&VPRKbp;)WY^!u|p0~B%j+K z(<>)V{04pv63p&SXx*jeNYT*Q3<7XTzSjV%Ye8%*bQyJjtl zXr9n>yiL_4N>zkoJt5n_uYi7b9q7Ug5~!NbPwZl@`^%VFhy!z&LI^Qrh+XXCCIil| zFxpTeXL6D&;Kc#0(-50gAr%b{B2acQ`LO-M&NV|Qn@>JJ8c-m~Yu z^`5tS`Lu`r;Kh3F$VZQ#ym~kOoMyQ?H9CO6x82wS!VR3ELu*cF{a~W9Vw1YaWNI{` zbxQZ={smf1eVgyZCDx#$dI${VqIS5O~ zyifJDMN0=^u8i~0l?9zp1RXqtXUakN7P)5ySb?SjZ98=J{{QCo^M8}XBUXSF_^%WY zol!6v;*w}@y|y^L*Lv7KVbiATYKwm;=$Ne-YxP#VgUuMmJ?$X+gtbMCpz)7@k%2o_ I;IAt18xH-2lmGw# diff --git a/src/.DS_Store b/src/.DS_Store deleted file mode 100644 index e8761022318047b0f6d07fa02adb2f70ac5e342c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK%SuB*3{A9)f(yG6m$P$M=^qTGE?oNomDYlb!WF8}?&gpDL_H^o(u>!nB9cII zax;_6%z--(5z+a}!%So%B4a2~=?nYlQsDEFOe}#lusNayqMi!$ zRE;NwdOG4I`qjYZ=;@+1GU~+0ACDKc(Gf4!U9>u;O$L&IJ_D!zIpO(#gI{Lwk>5|r zuVf$@_-730XmPigV^MLoepw#R+5)|YQrNH2fxz!w0`S3og#< O=0(5=Ns|ox0t4@ig)gxH