Spaces:
Sleeping
Sleeping
fix import summarize chain
Browse files
app.py
CHANGED
|
@@ -2,11 +2,14 @@ import os
|
|
| 2 |
import sys
|
| 3 |
import subprocess
|
| 4 |
|
| 5 |
-
|
| 6 |
-
subprocess.run(["git", "
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
from model import ChatGLMModel#, chat_template
|
| 12 |
|
|
@@ -61,7 +64,7 @@ import gradio as gr
|
|
| 61 |
from langchain.prompts import PromptTemplate
|
| 62 |
from langchain.docstore.document import Document
|
| 63 |
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
| 64 |
-
from langchain.chains.
|
| 65 |
# from langchain.chains.question_answering import load_qa_chain
|
| 66 |
# from langchain.embeddings import HuggingFaceEmbeddings
|
| 67 |
# from langchain.vectorstores import Chroma
|
|
|
|
| 2 |
import sys
|
| 3 |
import subprocess
|
| 4 |
|
| 5 |
+
if not os.path.exists("ChatGLM-6b-onnx-u8s8"):
|
| 6 |
+
subprocess.run(["git", "lfs", "install"])
|
| 7 |
+
subprocess.run(["git", "clone", "https://huggingface.co/K024/ChatGLM-6b-onnx-u8s8"])
|
| 8 |
+
os.chdir("ChatGLM-6b-onnx-u8s8")
|
| 9 |
+
subprocess.run(["pip", "install", "-r", "requirements.txt"])
|
| 10 |
+
sys.path.append(os.getcwd())
|
| 11 |
+
else:
|
| 12 |
+
sys.path.append(os.path.join(os.getcwd(), "ChatGLM-6b-onnx-u8s8"))
|
| 13 |
|
| 14 |
from model import ChatGLMModel#, chat_template
|
| 15 |
|
|
|
|
| 64 |
from langchain.prompts import PromptTemplate
|
| 65 |
from langchain.docstore.document import Document
|
| 66 |
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
| 67 |
+
from langchain.chains.summarize import load_summarize_chain
|
| 68 |
# from langchain.chains.question_answering import load_qa_chain
|
| 69 |
# from langchain.embeddings import HuggingFaceEmbeddings
|
| 70 |
# from langchain.vectorstores import Chroma
|