This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # you will need to install the following libraries | |
| # - FastAPI | |
| # - tweepy (version 4.X) | |
| # - twitter-text-parser | |
| # - apscheduler (version 3.X) | |
| import logging | |
| import os | |
| from datetime import datetime | |
| from typing import Optional, List |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import time | |
| from dataclasses import dataclass, field | |
| from pathlib import Path | |
| from typing import Literal | |
| from faster_whisper import WhisperModel | |
| model_size = "large-v3" | |
| # workaround if we have already installed openai whisper stuff via transformers |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from pdfminer.high_level import extract_text_to_fp | |
| from pdfminer.layout import LAParams | |
| def extract_text_from_pdf(input_filename: str, output_filename: str, output_images_dir: str | None = None) -> None: | |
| with open(input_filename, 'rb') as input_file, open(output_filename, 'w', encoding='utf-8') as output_file: | |
| extract_text_to_fp(input_file, output_file, output_dir=output_images_dir, laparams=LAParams()) | |
| extract_text_from_pdf( |
OlderNewer