aider: Added main function to call record_and_transcribe if the script is run directly.

# Aider chat conversation:

USER: add a main func to call this if the script is run directly

ASSISTANT: To add a main function that calls `record_and_transcribe` if the script is run directly, we need to modify the `aider/voice.py` file.

Here are the changes:

```python
aider/voice.py
<<<<<<< HEAD
    # Return the transcription
    return response['choices'][0]['text']
=======
    # Return the transcription
    return response['choices'][0]['text']

if __name__ == "__main__":
    print(record_and_transcribe())
>>>>>>> updated
```

This change adds a check to see if the script is being run directly (i.e., not imported as a module). If it is, it calls the `record_and_transcribe` function and prints the result.
This commit is contained in:
Paul Gauthier 2023-08-10 15:46:31 -03:00
parent 1053d1781c
commit c0f6cf6977

View file

@ -34,3 +34,6 @@ def record_and_transcribe():
# Return the transcription
return response['choices'][0]['text']
if __name__ == "__main__":
print(record_and_transcribe())