|
import requests |
|
|
|
|
|
url = "https://jikoni-semabox.hf.space/transcribe" |
|
|
|
|
|
audio_file_path = "/content/audio_samples/sample7.wav" |
|
|
|
|
|
|
|
try: |
|
with open(audio_file_path, 'rb') as audio_file: |
|
|
|
files = { |
|
'audio': audio_file |
|
} |
|
|
|
|
|
response = requests.post(url, files=files) |
|
|
|
|
|
if response.status_code == 200: |
|
|
|
print(response.json()) |
|
|
|
|
|
transcription = response.json().get('transcription', '') |
|
print(f"\nTranscription: {transcription}") |
|
|
|
else: |
|
|
|
print(f"Error: {response.status_code}, {response.text}") |
|
|
|
except FileNotFoundError: |
|
print(f"Error: The file {audio_file_path} was not found.") |
|
except requests.RequestException as e: |
|
print(f"Request error: {e}") |
|
|