Skip to content

Commit

Permalink
Merge pull request #649 from andrewyuau/fix-API-external-access
Browse files Browse the repository at this point in the history
Update API to allow option for external access
  • Loading branch information
PromtEngineer committed Nov 15, 2023
2 parents 8cb7168 + b8dfbe8 commit 54d38cf
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion run_localGPT_API.py
Expand Up @@ -2,6 +2,7 @@
import os
import shutil
import subprocess
import argparse

import torch
from flask import Flask, jsonify, request
Expand Down Expand Up @@ -178,7 +179,19 @@ def prompt_route():


if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--port", type=int, default=5110, help="Port to run the API on. Defaults to 5110.")
parser.add_argument(
"--host",
type=str,
default="127.0.0.1",
help="Host to run the UI on. Defaults to 127.0.0.1. "
"Set to 0.0.0.0 to make the UI externally "
"accessible from other devices.",
)
args = parser.parse_args()

logging.basicConfig(
format="%(asctime)s - %(levelname)s - %(filename)s:%(lineno)s - %(message)s", level=logging.INFO
)
app.run(debug=False, port=5110)
app.run(debug=False, host=args.host, port=args.port)

0 comments on commit 54d38cf

Please sign in to comment.