Code Monkey home page Code Monkey logo

llm_experiments's Introduction

LLM Experiments 🧪

Twitter URL Say Hi Say Hi

This is a personal repository with different LLM-based projects I've built. Click on 'Demo video' to see a video demonstration of every one of the projects in action! Also consider installing Double.bot, this is the AI copilot I use to build these projects.


1. Button.py

This file launches a simple UI with a textbox for inputs and a button. All you have to do is write some text into the textbox and push the button, then this message is sent to OpenAI's Text to speech (TTS) endpoint. You can have your message either streamed back (basically it will start playing before the full audio output is done being created), or not streamed (it will not play until the full TTS audio file has been created).

The purpose of this file is to show how much of an advantage streaming provides, plus provide basic code to implement streaming on your own. For some reason OpenAI mentions it on their documentation as something you can do, but provides no working examples, so here's mine for you :)

2. narrator.ipynb

This script takes an mp4 file in your local directory, and generates a narration of the contents in the video. Make sure to tweak the system prompt for best results.

3. streamed_text_plus_streamed_audio.py

In this file we make use of two different types of streaming. First, you have to input a message (try: How are you?). Then, this message is sent to gpt-3.5-turbo to generate a response. The response it generates is streamed into TTS (I chunk it so every time there is a period or ?! it sends a request to TTS), and the audio from TTS is streamed back as seen in the button.py file.

llm_experiments's People

Contributors

ggoonnzzaallo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

llm_experiments's Issues

Streaming error: soundfile.LibsndfileError: Supported file format but file is malformed

Thanks for publishing this example! It is working for me, mostly, but I'm consistently getting this exception:

>> data = sound_file.read(chunk_size, dtype='int16')

soundfile.LibsndfileError: Supported file format but file is malformed.

Full exception:

File "/Users/Michael/Documents/development/test.py", line 238, in say
    data = sound_file.read(chunk_size, dtype='int16')
  File "/Users/Michael/.pyenv/versions/test/lib/python3.9/site-packages/soundfile.py", line 895, in read
    frames = self._array_io('read', out, frames)
  File "/Users/Michael/.pyenv/versions/test/lib/python3.9/site-packages/soundfile.py", line 1344, in _array_io
    return self._cdata_io(action, cdata, ctype, frames)
  File "/Users/Michael/.pyenv/versions/test/lib/python3.9/site-packages/soundfile.py", line 1356, in _cdata_io
    self.seek(curr + frames, SEEK_SET)  # Update read & write position
  File "/Users/Michael/.pyenv/versions/test/lib/python3.9/site-packages/soundfile.py", line 802, in seek
    _error_check(self._errorcode)
  File "/Users/Michael/.pyenv/versions/test/lib/python3.9/site-packages/soundfile.py", line 1407, in _error_check
    raise LibsndfileError(err, prefix=prefix)
soundfile.LibsndfileError: Supported file format but file is malformed.

Would appreciate any suggestions you have.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.