Spaces:
Sleeping
Sleeping
Tuchuanhuhuhu
commited on
Commit
•
49612ba
1
Parent(s):
8fdf34e
加入GPT Index功能
Browse files- ChuanhuChatbot.py +3 -2
- chat_func.py +6 -30
- llama_func.py +5 -13
- utils.py +6 -30
ChuanhuChatbot.py
CHANGED
@@ -1,9 +1,10 @@
|
|
1 |
# -*- coding:utf-8 -*-
|
2 |
-
import gradio as gr
|
3 |
import os
|
4 |
import logging
|
5 |
import sys
|
6 |
-
|
|
|
|
|
7 |
from utils import *
|
8 |
from presets import *
|
9 |
from overwrites import *
|
|
|
1 |
# -*- coding:utf-8 -*-
|
|
|
2 |
import os
|
3 |
import logging
|
4 |
import sys
|
5 |
+
|
6 |
+
import gradio as gr
|
7 |
+
|
8 |
from utils import *
|
9 |
from presets import *
|
10 |
from overwrites import *
|
chat_func.py
CHANGED
@@ -1,43 +1,19 @@
|
|
1 |
# -*- coding:utf-8 -*-
|
2 |
from __future__ import annotations
|
3 |
-
from typing import TYPE_CHECKING,
|
|
|
4 |
import logging
|
5 |
import json
|
6 |
-
import gradio as gr
|
7 |
-
|
8 |
-
# import openai
|
9 |
import os
|
10 |
-
import traceback
|
11 |
import requests
|
12 |
|
13 |
-
# import markdown
|
14 |
-
import csv
|
15 |
-
import mdtex2html
|
16 |
-
from pypinyin import lazy_pinyin
|
17 |
-
from presets import *
|
18 |
-
from llama_func import *
|
19 |
-
from utils import *
|
20 |
-
import tiktoken
|
21 |
from tqdm import tqdm
|
22 |
import colorama
|
23 |
-
import os
|
24 |
-
from llama_index import (
|
25 |
-
GPTSimpleVectorIndex,
|
26 |
-
GPTTreeIndex,
|
27 |
-
GPTKeywordTableIndex,
|
28 |
-
GPTListIndex,
|
29 |
-
)
|
30 |
-
from llama_index import SimpleDirectoryReader, download_loader
|
31 |
-
from llama_index import (
|
32 |
-
Document,
|
33 |
-
LLMPredictor,
|
34 |
-
PromptHelper,
|
35 |
-
QuestionAnswerPrompt,
|
36 |
-
RefinePrompt,
|
37 |
-
)
|
38 |
-
from langchain.llms import OpenAIChat, OpenAI
|
39 |
from duckduckgo_search import ddg
|
40 |
-
|
|
|
|
|
|
|
41 |
|
42 |
# logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(levelname)s] [%(filename)s:%(lineno)d] %(message)s")
|
43 |
|
|
|
1 |
# -*- coding:utf-8 -*-
|
2 |
from __future__ import annotations
|
3 |
+
from typing import TYPE_CHECKING, List
|
4 |
+
|
5 |
import logging
|
6 |
import json
|
|
|
|
|
|
|
7 |
import os
|
|
|
8 |
import requests
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
from tqdm import tqdm
|
11 |
import colorama
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
from duckduckgo_search import ddg
|
13 |
+
|
14 |
+
from presets import *
|
15 |
+
from llama_func import *
|
16 |
+
from utils import *
|
17 |
|
18 |
# logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(levelname)s] [%(filename)s:%(lineno)d] %(message)s")
|
19 |
|
llama_func.py
CHANGED
@@ -1,11 +1,8 @@
|
|
1 |
import os
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
GPTListIndex,
|
7 |
-
)
|
8 |
-
from llama_index import SimpleDirectoryReader, download_loader
|
9 |
from llama_index import (
|
10 |
Document,
|
11 |
LLMPredictor,
|
@@ -13,14 +10,9 @@ from llama_index import (
|
|
13 |
QuestionAnswerPrompt,
|
14 |
RefinePrompt,
|
15 |
)
|
16 |
-
from langchain.llms import
|
17 |
-
from googlesearch import search as google_search
|
18 |
-
from baidusearch.baidusearch import search as baidu_search
|
19 |
-
from duckduckgo_search import ddg
|
20 |
import colorama
|
21 |
|
22 |
-
import logging
|
23 |
-
import sys
|
24 |
|
25 |
from presets import *
|
26 |
from utils import *
|
|
|
1 |
import os
|
2 |
+
import logging
|
3 |
+
|
4 |
+
from llama_index import GPTSimpleVectorIndex
|
5 |
+
from llama_index import download_loader
|
|
|
|
|
|
|
6 |
from llama_index import (
|
7 |
Document,
|
8 |
LLMPredictor,
|
|
|
10 |
QuestionAnswerPrompt,
|
11 |
RefinePrompt,
|
12 |
)
|
13 |
+
from langchain.llms import OpenAI
|
|
|
|
|
|
|
14 |
import colorama
|
15 |
|
|
|
|
|
16 |
|
17 |
from presets import *
|
18 |
from utils import *
|
utils.py
CHANGED
@@ -3,40 +3,16 @@ from __future__ import annotations
|
|
3 |
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Tuple, Type
|
4 |
import logging
|
5 |
import json
|
6 |
-
import gradio as gr
|
7 |
-
|
8 |
-
# import openai
|
9 |
import os
|
10 |
-
import
|
11 |
-
import
|
12 |
-
|
13 |
-
# import markdown
|
14 |
import csv
|
15 |
-
|
|
|
16 |
from pypinyin import lazy_pinyin
|
17 |
-
from presets import *
|
18 |
import tiktoken
|
19 |
-
|
20 |
-
import
|
21 |
-
import os
|
22 |
-
from llama_index import (
|
23 |
-
GPTSimpleVectorIndex,
|
24 |
-
GPTTreeIndex,
|
25 |
-
GPTKeywordTableIndex,
|
26 |
-
GPTListIndex,
|
27 |
-
)
|
28 |
-
from llama_index import SimpleDirectoryReader, download_loader
|
29 |
-
from llama_index import (
|
30 |
-
Document,
|
31 |
-
LLMPredictor,
|
32 |
-
PromptHelper,
|
33 |
-
QuestionAnswerPrompt,
|
34 |
-
RefinePrompt,
|
35 |
-
)
|
36 |
-
from langchain.llms import OpenAIChat, OpenAI
|
37 |
-
from duckduckgo_search import ddg
|
38 |
-
import datetime
|
39 |
-
import hashlib
|
40 |
|
41 |
# logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(levelname)s] [%(filename)s:%(lineno)d] %(message)s")
|
42 |
|
|
|
3 |
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Tuple, Type
|
4 |
import logging
|
5 |
import json
|
|
|
|
|
|
|
6 |
import os
|
7 |
+
import datetime
|
8 |
+
import hashlib
|
|
|
|
|
9 |
import csv
|
10 |
+
|
11 |
+
import gradio as gr
|
12 |
from pypinyin import lazy_pinyin
|
|
|
13 |
import tiktoken
|
14 |
+
|
15 |
+
from presets import *
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
# logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(levelname)s] [%(filename)s:%(lineno)d] %(message)s")
|
18 |
|