Spaces:
Running
Running
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import os
|
3 |
+
|
4 |
+
from langchain_community.document_loaders import PyPDFLoader
|
5 |
+
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
6 |
+
from langchain_community.vectorstores import Chroma
|
7 |
+
from langchain.chains import ConversationalRetrievalChain
|
8 |
+
from langchain_community.embeddings import HuggingFaceEmbeddings
|
9 |
+
from langchain_community.llms import HuggingFacePipeline
|
10 |
+
from langchain.chains import ConversationChain
|
11 |
+
from langchain.memory import ConversationBufferMemory
|
12 |
+
from langchain_community.llms import HuggingFaceEndpoint
|
13 |
+
|
14 |
+
from pathlib import Path
|
15 |
+
import chromadb
|
16 |
+
from unidecode import unidecode
|
17 |
+
|
18 |
+
from transformers import AutoTokenizer
|
19 |
+
import transformers
|
20 |
+
import torch
|
21 |
+
import tqdm
|
22 |
+
import accelerate
|
23 |
+
import re
|
24 |
+
|
25 |
+
|
26 |
+
|
27 |
+
# default_persist_directory = './chroma_HF/'
|
28 |
+
list_llm = ["mistralai/Mistral-7B-Instruct-v0.2", "mistralai/Mixtral-8x7B-Instruct-v0.1", "mistralai/Mistral-7B-Instruct-v0.1", \
|
29 |
+
"google/gemma-7b-it","google/gemma-2b-it", \
|
30 |
+
"HuggingFaceH4/zephyr-7b-beta", "HuggingFaceH4/zephyr-7b-gemma-v0.1", \
|
31 |
+
"meta-llama/Llama-2-7b-chat-hf", "microsoft/phi-2", \
|
32 |
+
"TinyLlama/TinyLlama-1.1B-Chat-v1.0", "mosaicml/mpt-7b-instruct", "tiiuae/falcon-7b-instruct", \
|
33 |
+
"google/flan-t5-xxl"
|
34 |
+
]
|
35 |
+
list_llm_simple = [os.path.basename(llm) for llm in list_llm]
|
36 |
+
|
37 |
+
demo()
|