Recherche avancée

Médias (91)

Autres articles (78)

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

  • Des sites réalisés avec MediaSPIP

    2 mai 2011, par

    Cette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
    Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.

  • Configurer la prise en compte des langues

    15 novembre 2010, par

    Accéder à la configuration et ajouter des langues prises en compte
    Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
    De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
    Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...)

Sur d’autres sites (7334)

  • Title : Getting "invalid_request_error" when trying to pass converted audio file to OpenAI API

    19 avril 2023, par Dummy Cron

    I am working on a project where I receive a URL from a webhook on my server whenever users share a voice note on my WhatsApp. I am using WATI as my WhatsApp API Provder

    


    The file URL received is in the .opus format, which I need to convert to WAV and pass to the OpenAI Whisper API translation task.

    


    I am trying convert it to .wav using ffmpeg, and pass it to the OpenAI API for translation processing.
However, I am getting an "invalid_request_error"

    


    import requests
import io
import subprocess
file_url = #.opus file url
api_key = #WATI API Keu

def transcribe_audio_to_text():
  # Fetch the audio file and convert to wav format

  headers = {'Authorization': f'Bearer {api_key}'}
  response = requests.get(file_url, headers=headers)
  audio_bytes = io.BytesIO(response.content)

  process = subprocess.Popen(['ffmpeg', '-i', '-', '-f', 'wav', '-acodec', 'libmp3lame', '-'], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
  wav_audio, _ = process.communicate(input=audio_bytes.read())

  # Set the Whisper API endpoint and headers
  WHISPER_API_ENDPOINT = 'https://api.openai.com/v1/audio/translations'
  whisper_api_headers = {'Authorization': 'Bearer ' + WHISPER_API_KEY,
                         'Content-Type': 'application/json'}
  print(whisper_api_headers)
  # Send the audio file for transcription

  payload = {'model': 'whisper-1'}
  files = {'file': ('audio.wav', io.BytesIO(wav_audio), 'audio/wav')}

  # files = {'file': ('audio.wav', io.BytesIO(wav_audio), 'application/octet-stream')}

  # files = {'file': ('audio.mp3', io.BytesIO(mp3_audio), 'audio/mp3')}
  response = requests.post(WHISPER_API_ENDPOINT, headers=whisper_api_headers, data=payload)
  print(response)
  # Get the transcription text
  if response.status_code == 200:
      result = response.json()
      text = result['text']
      print(response, text)
  else:
      print('Error:', response)
      err = response.json()
      print(response.status_code)
      print(err)
      print(response.headers)

transcribe_audio_to_text()


    


    Output :

    


    Error: <response>&#xA;400&#xA;{&#x27;error&#x27;: {&#x27;message&#x27;: "We could not parse the JSON body of your request. (HINT: This likely means you aren&#x27;t using your HTTP library correctly. The OpenAI API expects a JSON payload, but what was sent was not valid JSON. If you have trouble figuring out how to fix this, please send an email to support@openai.com and include any relevant code you&#x27;d like help with.)", &#x27;type&#x27;: &#x27;invalid_request_error&#x27;, &#x27;param&#x27;: None, &#x27;code&#x27;: None}}&#xA;</response>

    &#xA;

  • It’s Piwik Analytics Survey time : Your Opinion Matters !

    10 juillet 2014, par Piwik Core Team — Community

    It’s been almost two years since our last survey. We were so happy to get the participation we did from the community last time and hope that you will once again share your thoughts !

    Piwik Survey

    Fill in the survey

    Looking back on the previous survey, several features were implemented as a direct result :

    • New app design with Morpheus theme
    • Piwik Marketplace for Plugins
    • Visitor Profile
    • Performance and Reliability Improvements
    • Theming
    • Migrated from SVN to Github !
    • And much more…

    Now it is time to ask for your opinion again. Sure it’s only 20 short questions, but your time you take and energy you place in this endeavour will shape Piwik development and features for the near future. We really look forward to your ideas, your opinions and your suggestions. To get started click the box (or link) below :

    Piwik Survey

    Fill in the survey !

    By the way, if you haven’t already make sure you sign up for our newsletter to make sure you get the latest Piwik news and information to your inbox ! You can subscribe here.
  • It’s Piwik Analytics Survey time : Your Opinion Matters !

    10 juillet 2014, par Piwik Core Team — Community

    It’s been almost two years since our last survey. We were so happy to get the participation we did from the community last time and hope that you will once again share your thoughts !

    Piwik Survey

    Fill in the survey

    Looking back on the previous survey, several features were implemented as a direct result :

    • New app design with Morpheus theme
    • Piwik Marketplace for Plugins
    • Visitor Profile
    • Performance and Reliability Improvements
    • Theming
    • Migrated from SVN to Github !
    • And much more…

    Now it is time to ask for your opinion again. Sure it’s only 20 short questions, but your time you take and energy you place in this endeavour will shape Piwik development and features for the near future. We really look forward to your ideas, your opinions and your suggestions. To get started click the box (or link) below :

    Piwik Survey

    Fill in the survey !

    By the way, if you haven’t already make sure you sign up for our newsletter to make sure you get the latest Piwik news and information to your inbox ! You can subscribe here.