Skip to content

Instantly share code, notes, and snippets.

View TarickWake's full-sized avatar
🐍

Clément T. TarickWake

🐍
View GitHub Profile
@TarickWake
TarickWake / importer_tiff_readme.md
Last active June 19, 2024 12:30
imort into array of array tif image fast ! ["frame", "y_im", "x_im", "rgb"]

📸 TIFF loading FAST !

This Python script is designed to load images from a specified directory using a ThreadPoolExecutor for concurrent execution. It reads all .tif files from the "tif" directory and processes them in parallel, utilizing multiple threads to speed up the image loading process.

Important Note: The order of the images is preserved throughout this process. The executor.map method guarantees that the results are returned in the same order as the input paths, ensuring that the correspondence between the file paths and the loaded images is maintained.

🛠️ Dependencies

  • 🖥️ os (built-in): For interacting with the operating system to list files in a directory.
  • 📷 cv2 (OpenCV, to be installed): For reading image files.
  • 📁 pathlib (built-in): For manipulating filesystem paths in a platform-independent way.
  • 🌐 concurrent.futures.ThreadPoolExecutor (built-in): For managing a pool of threads to execute calls asynchronously.
"""
Author: Clement TIFFON
Date: 14-06-2023
Description: This is a simple GUI for the OpenAI Text-to-Speech API. This is an example of a Streamlit app that uses the OpenAI API to convert text to speech. The app allows users to enter text in a chat input field, which is then converted to speech using the OpenAI API. The app displays the chat history and the corresponding audio files. The app uses the OpenAI Python client library to interact with the OpenAI API. The app also uses the Streamlit chat input and audio components to create a chat interface for the user. The app is a simple example of how to use the OpenAI API with Streamlit to create a text-to-speech application.
to run the app, you need to install the following libraries:
- streamlit
- openai
- numpy