Skip to content

Instantly share code, notes, and snippets.

View tuanlda78202's full-sized avatar
🖥️
Working

charles tuanlda78202

🖥️
Working
View GitHub Profile
import os
import csv
import torch
from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor, pipeline
from tqdm import tqdm
def transcribe_audio_files(input_dir, output_csv):
device = "cuda:0" if torch.cuda.is_available() else "cpu"
torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
@tuanlda78202
tuanlda78202 / vnrag.py
Created June 11, 2024 03:09
Vietnamese RAG (Vistral + Multilingual E5) with Langchain and Streamlit UI
import os
import streamlit as st
from streamlit_chat import message
from dotenv import load_dotenv
from huggingface_hub import hf_hub_download
# LangChain Core imports
from langchain_core.messages import HumanMessage, AIMessage
from langchain_core.prompts import ChatPromptTemplate
from langchain_core.runnables import RunnablePassthrough