CoolFace
Datasetpublic

model-metadata/code_python_files

sourceHugging Faceupdated 7mo agoView on Hugging Face
0likes14kdownloads
openai_whisper-large-v3_3.py60 linesDownload Raw Back to root
1# /// script2# requires-python = ">=3.12"3# dependencies = [4#     "torch",5#     "torchvision",6#     "transformers",7#     "accelerate",8#     "peft",9#     "slack-sdk",10# ]11# ///12 13try:14    import os15    from huggingface_hub import InferenceClient16    17    client = InferenceClient(18        provider="auto",19        api_key=os.environ["HF_TOKEN"],20    )21    22    output = client.automatic_speech_recognition("sample1.flac", model="openai/whisper-large-v3")23    with open('openai_whisper-large-v3_3.txt', 'w', encoding='utf-8') as f:24        f.write('Everything was good in openai_whisper-large-v3_3.txt')25except Exception as e:26    import os27    from slack_sdk import WebClient28    client = WebClient(token=os.environ['SLACK_TOKEN'])29    client.chat_postMessage(30        channel='#exp-slack-alerts',31        text='Problem in <https://huggingface.co/datasets/model-metadata/code_execution_files/blob/main/openai_whisper-large-v3_3.txt|openai_whisper-large-v3_3.txt>',32    )33 34    with open('openai_whisper-large-v3_3.txt', 'a', encoding='utf-8') as f:35        import traceback36        f.write('''```CODE: 37import os38from huggingface_hub import InferenceClient39 40client = InferenceClient(41    provider="auto",42    api_key=os.environ["HF_TOKEN"],43)44 45output = client.automatic_speech_recognition("sample1.flac", model="openai/whisper-large-v3")46```47 48ERROR: 49''')50        traceback.print_exc(file=f)51    52finally:53    from huggingface_hub import upload_file54    upload_file(55        path_or_fileobj='openai_whisper-large-v3_3.txt',56        repo_id='model-metadata/code_execution_files',57        path_in_repo='openai_whisper-large-v3_3.txt',58        repo_type='dataset',59    )60