~ | Merge pull request #869 from ahobsonsayers/add-console-script

~ | Add console script
This commit is contained in:
Tekky 2023-09-05 15:04:00 +01:00 committed by GitHub
commit 8fe76cc4c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 6 deletions

View File

@ -12,6 +12,7 @@ from g4f import ChatCompletion
app = Flask(__name__)
CORS(app)
@app.route("/chat/completions", methods=["POST"])
def chat_completions():
model = request.get_json().get("model", "gpt-3.5-turbo")
@ -87,5 +88,9 @@ def chat_completions():
return app.response_class(streaming(), mimetype="text/event-stream")
def main():
app.run(host="0.0.0.0", port=1337, debug=True)
if __name__ == "__main__":
app.run(host="0.0.0.0", port=1337, debug=True)
main()

View File

@ -11,7 +11,10 @@ with codecs.open(os.path.join(here, "README.md"), encoding="utf-8") as fh:
with open("requirements.txt") as f:
required = f.read().splitlines()
VERSION = '0.0.2.6'
with open("interference/requirements.txt") as f:
api_required = f.read().splitlines()
VERSION = "0.0.2.6"
DESCRIPTION = (
"The official gpt4free repository | various collection of powerful language models"
)
@ -26,11 +29,16 @@ setup(
long_description_content_type="text/markdown",
long_description=long_description,
packages=find_packages(),
data_files=["interference/app.py"],
install_requires=required,
url='https://github.com/xtekky/gpt4free', # Link to your GitHub repository
extras_require={"api": api_required},
entry_points={
"console_scripts": ["g4f=interference.app:main"],
},
url="https://github.com/xtekky/gpt4free", # Link to your GitHub repository
project_urls={
'Source Code': 'https://github.com/xtekky/gpt4free', # GitHub link
'Bug Tracker': 'https://github.com/xtekky/gpt4free/issues', # Link to issue tracker
"Source Code": "https://github.com/xtekky/gpt4free", # GitHub link
"Bug Tracker": "https://github.com/xtekky/gpt4free/issues", # Link to issue tracker
},
keywords=[
"python",
@ -65,4 +73,4 @@ setup(
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
],
)
)