summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArran Hobson Sayers <ahobsonsayers@gmail.com>2023-08-31 13:32:23 +0200
committerArran Hobson Sayers <ahobsonsayers@gmail.com>2023-08-31 13:32:23 +0200
commiteee553bd466a14514613073ac3169e919799abfb (patch)
tree2c5ceb7cb6e12b0261e504a5d066d39a231ed726
parent~ (diff)
downloadgpt4free-eee553bd466a14514613073ac3169e919799abfb.tar
gpt4free-eee553bd466a14514613073ac3169e919799abfb.tar.gz
gpt4free-eee553bd466a14514613073ac3169e919799abfb.tar.bz2
gpt4free-eee553bd466a14514613073ac3169e919799abfb.tar.lz
gpt4free-eee553bd466a14514613073ac3169e919799abfb.tar.xz
gpt4free-eee553bd466a14514613073ac3169e919799abfb.tar.zst
gpt4free-eee553bd466a14514613073ac3169e919799abfb.zip
-rw-r--r--interference/app.py7
-rw-r--r--requirements.txt3
-rw-r--r--setup.py18
3 files changed, 21 insertions, 7 deletions
diff --git a/interference/app.py b/interference/app.py
index 8018356f..836a751d 100644
--- a/interference/app.py
+++ b/interference/app.py
@@ -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) \ No newline at end of file
+ main()
diff --git a/requirements.txt b/requirements.txt
index 5caad54e..9d14abfa 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -8,4 +8,5 @@ websockets
js2py
quickjs
flask
-flask-cors \ No newline at end of file
+flask-cors
+httpx \ No newline at end of file
diff --git a/setup.py b/setup.py
index ef4e3d61..698c6f6d 100644
--- a/setup.py
+++ b/setup.py
@@ -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",
],
-) \ No newline at end of file
+)