seanpedrickcase commited on
Commit
c79d667
·
1 Parent(s): f0668f6

Can now specify root path for app with an environment variable

Browse files
Files changed (4) hide show
  1. Dockerfile +1 -1
  2. app.py +5 -2
  3. tools/llm_api_call.py +1 -0
  4. tools/prompts.py +1 -1
Dockerfile CHANGED
@@ -8,7 +8,7 @@ RUN apt-get update \
8
 
9
  WORKDIR /src
10
 
11
- COPY requirements.txt .
12
 
13
  RUN pip uninstall -y typing_extensions \
14
  && pip install --no-cache-dir --target=/install typing_extensions==4.12.2 \
 
8
 
9
  WORKDIR /src
10
 
11
+ COPY requirements_cpu.txt .
12
 
13
  RUN pip uninstall -y typing_extensions \
14
  && pip install --no-cache-dir --target=/install typing_extensions==4.12.2 \
app.py CHANGED
@@ -347,8 +347,11 @@ print(f'The value of MAX_FILE_SIZE is {MAX_FILE_SIZE}')
347
  GRADIO_SERVER_PORT = int(get_or_create_env_var('GRADIO_SERVER_PORT', '7861'))
348
  print(f'The value of GRADIO_SERVER_PORT is {GRADIO_SERVER_PORT}')
349
 
 
 
 
350
  if __name__ == "__main__":
351
  if os.environ['COGNITO_AUTH'] == "1":
352
- app.queue(max_size=MAX_QUEUE_SIZE).launch(show_error=True, auth=authenticate_user, max_file_size=MAX_FILE_SIZE, server_port=GRADIO_SERVER_PORT)
353
  else:
354
- app.queue(max_size=MAX_QUEUE_SIZE).launch(show_error=True, inbrowser=True, max_file_size=MAX_FILE_SIZE, server_port=GRADIO_SERVER_PORT)
 
347
  GRADIO_SERVER_PORT = int(get_or_create_env_var('GRADIO_SERVER_PORT', '7861'))
348
  print(f'The value of GRADIO_SERVER_PORT is {GRADIO_SERVER_PORT}')
349
 
350
+ ROOT_PATH = get_or_create_env_var('ROOT_PATH', '')
351
+ print(f'The value of ROOT_PATH is {ROOT_PATH}')
352
+
353
  if __name__ == "__main__":
354
  if os.environ['COGNITO_AUTH'] == "1":
355
+ app.queue(max_size=MAX_QUEUE_SIZE).launch(show_error=True, auth=authenticate_user, max_file_size=MAX_FILE_SIZE, server_port=GRADIO_SERVER_PORT, root_path=ROOT_PATH)
356
  else:
357
+ app.queue(max_size=MAX_QUEUE_SIZE).launch(show_error=True, inbrowser=True, max_file_size=MAX_FILE_SIZE, server_port=GRADIO_SERVER_PORT, root_path=ROOT_PATH)
tools/llm_api_call.py CHANGED
@@ -1648,6 +1648,7 @@ def summarise_output_topics(summarised_references:pd.DataFrame,
1648
  summarised_output = response
1649
  summarised_output = re.sub(r'\n{2,}', '\n', summarised_output) # Replace multiple line breaks with a single line break
1650
  summarised_output = re.sub(r'^\n{1,}', '', summarised_output) # Remove one or more line breaks at the start
 
1651
  except Exception as e:
1652
  print(e)
1653
  summarised_output = ""
 
1648
  summarised_output = response
1649
  summarised_output = re.sub(r'\n{2,}', '\n', summarised_output) # Replace multiple line breaks with a single line break
1650
  summarised_output = re.sub(r'^\n{1,}', '', summarised_output) # Remove one or more line breaks at the start
1651
+ summarised_output = summarised_output.strip()
1652
  except Exception as e:
1653
  print(e)
1654
  summarised_output = ""
tools/prompts.py CHANGED
@@ -29,7 +29,7 @@ Topics known to be relevant to this dataset are shown in the following Topics ta
29
 
30
  Your task is to create one new markdown table, assigning responses from the Response table to existing topics, or to create new topics if no existing topics are relevant.
31
  Create a new markdown table with the headings 'General Topic', 'Subtopic', 'Sentiment', 'Summary', and 'Response references'.
32
- In the first and second columns, assign General Topics and Subtopics to Responses. Assign topics from the Topics table above if they are very relevant to the text of the Response. If you find a new topic that does not exist in the Topics table, add a new row to the new table. Make the General Topic and Subtopic as specific as possible.
33
  In the third column, write the sentiment of the Subtopic: Negative, Neutral, or Positive.
34
  In the fourth column list each specific Response reference number that is relevant to the Subtopic, separated by commas. Do no write any other text in this column.
35
  In the fifth and final column, write a short summary of the Subtopic based on relevant responses. Highlight specific issues that appear in relevant responses.
 
29
 
30
  Your task is to create one new markdown table, assigning responses from the Response table to existing topics, or to create new topics if no existing topics are relevant.
31
  Create a new markdown table with the headings 'General Topic', 'Subtopic', 'Sentiment', 'Summary', and 'Response references'.
32
+ In the first and second columns, assign General Topics and Subtopics to Responses. Assign topics from the Topics table above if they are very relevant to the text of the Response. Fill in the General Topic and Sentiment for the Subtopic if they do not already exist. If you find a new topic that does not exist in the Topics table, add a new row to the new table. Make the General Topic and Subtopic as specific as possible.
33
  In the third column, write the sentiment of the Subtopic: Negative, Neutral, or Positive.
34
  In the fourth column list each specific Response reference number that is relevant to the Subtopic, separated by commas. Do no write any other text in this column.
35
  In the fifth and final column, write a short summary of the Subtopic based on relevant responses. Highlight specific issues that appear in relevant responses.