From 94ad2bb7fc398bf9ebc4b31d7ff0619529877952 Mon Sep 17 00:00:00 2001 From: "tujianhong.tjh" Date: Sun, 7 Apr 2024 20:42:30 +0800 Subject: [PATCH] release version 0.0.1 and upload it to pypi --- MANIFEST.in | 5 ----- qwen_agent/memory/memory.py | 3 ++- qwen_server/assistant_server.py | 11 ++++++++++- qwen_server/workstation_server.py | 11 ++++++++++- requirements.txt | 6 ------ setup.py | 9 +++++++-- 6 files changed, 29 insertions(+), 16 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index 1b89c4d..7671027 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,7 +1,2 @@ -include qwen_server/img/* -include qwen_server/css/* -include qwen_server/js/* -include qwen_server/*.json -recursive-include browser_qwen * include qwen_agent/utils/qwen.tiktoken recursive-include qwen_agent/tools/resource * diff --git a/qwen_agent/memory/memory.py b/qwen_agent/memory/memory.py index dbd8b8b..da74899 100644 --- a/qwen_agent/memory/memory.py +++ b/qwen_agent/memory/memory.py @@ -1,3 +1,4 @@ +import json from typing import Dict, Iterator, List, Optional, Union import json5 @@ -83,7 +84,7 @@ def _run(self, logger.info(keyword) keyword_dict = json5.loads(keyword) keyword_dict['text'] = query - query = keyword_dict + query = json.dumps(keyword_dict, ensure_ascii=False) except Exception: query = query diff --git a/qwen_server/assistant_server.py b/qwen_server/assistant_server.py index 61c2ec7..339eeae 100644 --- a/qwen_server/assistant_server.py +++ b/qwen_server/assistant_server.py @@ -8,7 +8,16 @@ except ImportError: pass -import gradio as gr +try: + import gradio as gr + if gr.__version__ < '3.50' or gr.__version__ >= '4.0': + raise ImportError( + 'Incompatible gradio version detected. ' + 'Please install the correct version with: pip install "gradio>=3.50,<4.0"' + ) +except (ModuleNotFoundError, AttributeError): + raise ImportError( + 'Please install gradio by: pip install "gradio>=3.50,<4.0"') import jsonlines from qwen_agent.agents import DocQAAgent diff --git a/qwen_server/workstation_server.py b/qwen_server/workstation_server.py index b98b29b..b38839c 100644 --- a/qwen_server/workstation_server.py +++ b/qwen_server/workstation_server.py @@ -3,7 +3,16 @@ import os from pathlib import Path -import gradio as gr +try: + import gradio as gr + if gr.__version__ < '3.50' or gr.__version__ >= '4.0': + raise ImportError( + 'Incompatible gradio version detected. ' + 'Please install the correct version with: pip install "gradio>=3.50,<4.0"' + ) +except (ModuleNotFoundError, AttributeError): + raise ImportError( + 'Please install gradio by: pip install "gradio>=3.50,<4.0"') import json5 try: diff --git a/requirements.txt b/requirements.txt index d130906..5982a60 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,8 +3,6 @@ beautifulsoup4 dashscope>=1.11.0 docx2txt fastapi>=0.103.1 -gradio<4.0.0 -gradio-client>=0.5.0 html2text jieba json5 @@ -14,15 +12,11 @@ matplotlib numpy openai pandas -pdf2image pdfminer-six pillow pydantic>=2.3.0 -pypdf python-pptx seaborn sympy tiktoken -unstructured==0.8.0 uvicorn>=0.23.2 -wordcloud diff --git a/setup.py b/setup.py index 6eb2f74..1fab55e 100644 --- a/setup.py +++ b/setup.py @@ -11,6 +11,11 @@ def read_requirements(): setup( name='qwen_agent', version='0.0.1', - packages=find_packages(), + packages=find_packages( + exclude=['examples', 'examples.*', 'qwen_server', 'qwen_server.*']), + package_data={ + 'qwen_agent': + ['utils/qwen.tiktoken', 'tools/resource/*.ttf', 'tools/resource/*.py'], + }, install_requires=read_requirements(), -) + url='https://github.com/QwenLM/Qwen-Agent')