yaleh commited on
Commit
c59af18
·
1 Parent(s): f81c1c5

Added Dockerfile.

Browse files
Files changed (2) hide show
  1. Dockerfile +24 -0
  2. meta_prompt.py +3 -2
Dockerfile ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use an official Python runtime as the base image
2
+ FROM python:3.9
3
+
4
+ # Set the working directory in the container
5
+ WORKDIR /app
6
+
7
+ # Copy all files from the current directory to the working directory in the container
8
+ COPY . /app/
9
+
10
+ # Install the required dependencies from requirements.txt
11
+ RUN pip install --no-cache-dir -r requirements.txt
12
+
13
+ # Set the environment variables
14
+ ENV API_KEY=""
15
+ ENV PROXY=""
16
+ ENV OTHER_ARGS="--advanced_mode"
17
+ ENV ADVANCED_MODE="true"
18
+ ENV SERVER_NAME="0.0.0.0"
19
+
20
+ # Expose the port (if necessary)
21
+ EXPOSE 7860
22
+
23
+ # Run the script when the container launches
24
+ CMD /usr/local/bin/python3 meta_prompt.py --api_key=${API_KEY} --proxy=${PROXY} --server_name=${SERVER_NAME} ${OTHER_ARGS}
meta_prompt.py CHANGED
@@ -35,7 +35,7 @@ class ChatbotApp:
35
  ['Prompt']
36
  )
37
  def launch(self, *args, **kwargs):
38
- self.ui.launch(args, kwargs)
39
 
40
  def parse_args():
41
  parser = argparse.ArgumentParser()
@@ -45,10 +45,11 @@ def parse_args():
45
  help="Launch app with sharing option")
46
  parser.add_argument("--advanced_mode", action='store_true', default=False,
47
  help="Enable advanced mode")
 
48
 
49
  return parser.parse_args()
50
 
51
  if __name__ == "__main__":
52
  args = parse_args()
53
  app = ChatbotApp(args)
54
- app.ui.queue().launch(share=args.share)
 
35
  ['Prompt']
36
  )
37
  def launch(self, *args, **kwargs):
38
+ self.ui.launch(*args, **kwargs)
39
 
40
  def parse_args():
41
  parser = argparse.ArgumentParser()
 
45
  help="Launch app with sharing option")
46
  parser.add_argument("--advanced_mode", action='store_true', default=False,
47
  help="Enable advanced mode")
48
+ parser.add_argument("--server_name", type=str, default="127.0.0.1", help="Server name or IP address")
49
 
50
  return parser.parse_args()
51
 
52
  if __name__ == "__main__":
53
  args = parse_args()
54
  app = ChatbotApp(args)
55
+ app.launch(share=args.share, server_name=args.server_name)