Spaces:
Sleeping
Sleeping
yanyoyo
commited on
Commit
·
d5c7d7b
1
Parent(s):
0ebb649
fix
Browse files
app.py
CHANGED
|
@@ -3,26 +3,26 @@ from llama_index.core import VectorStoreIndex, SimpleDirectoryReader, Settings
|
|
| 3 |
from llama_index.embeddings.huggingface import HuggingFaceEmbedding
|
| 4 |
from llama_index.llms.huggingface import HuggingFaceLLM
|
| 5 |
|
| 6 |
-
st.set_page_config(page_title="
|
| 7 |
-
st.title("
|
| 8 |
|
| 9 |
# 初始化模型
|
| 10 |
@st.cache_resource
|
| 11 |
def init_models():
|
| 12 |
embed_model = HuggingFaceEmbedding(
|
| 13 |
-
model_name="
|
| 14 |
)
|
| 15 |
Settings.embed_model = embed_model
|
| 16 |
|
| 17 |
llm = HuggingFaceLLM(
|
| 18 |
-
model_name="/
|
| 19 |
-
tokenizer_name="/
|
| 20 |
model_kwargs={"trust_remote_code": True},
|
| 21 |
tokenizer_kwargs={"trust_remote_code": True}
|
| 22 |
)
|
| 23 |
Settings.llm = llm
|
| 24 |
|
| 25 |
-
documents = SimpleDirectoryReader("/
|
| 26 |
index = VectorStoreIndex.from_documents(documents)
|
| 27 |
query_engine = index.as_query_engine()
|
| 28 |
|
|
|
|
| 3 |
from llama_index.embeddings.huggingface import HuggingFaceEmbedding
|
| 4 |
from llama_index.llms.huggingface import HuggingFaceLLM
|
| 5 |
|
| 6 |
+
st.set_page_config(page_title="Streamlit-LlamaIndex-API", page_icon="🦜🔗")
|
| 7 |
+
st.title("Streamlit-LlamaIndex-API")
|
| 8 |
|
| 9 |
# 初始化模型
|
| 10 |
@st.cache_resource
|
| 11 |
def init_models():
|
| 12 |
embed_model = HuggingFaceEmbedding(
|
| 13 |
+
model_name="sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2"
|
| 14 |
)
|
| 15 |
Settings.embed_model = embed_model
|
| 16 |
|
| 17 |
llm = HuggingFaceLLM(
|
| 18 |
+
model_name="internlm/internlm2_5-1_8b-chat",
|
| 19 |
+
tokenizer_name="internlm/internlm2_5-1_8b-chat",
|
| 20 |
model_kwargs={"trust_remote_code": True},
|
| 21 |
tokenizer_kwargs={"trust_remote_code": True}
|
| 22 |
)
|
| 23 |
Settings.llm = llm
|
| 24 |
|
| 25 |
+
documents = SimpleDirectoryReader("Streamlit-LlamaIndex-API/data").load_data()
|
| 26 |
index = VectorStoreIndex.from_documents(documents)
|
| 27 |
query_engine = index.as_query_engine()
|
| 28 |
|