avreymi commited on
Commit
11a95cf
1 Parent(s): 49f0a7a
Files changed (3) hide show
  1. Dockerfile +0 -1
  2. app.py +16 -3
  3. pipline.py +1 -1
Dockerfile CHANGED
@@ -17,7 +17,6 @@ ENV HOME=/home/user \
17
  WORKDIR $HOME/app
18
 
19
  COPY --chown=user . $HOME/app
20
- RUN --mount=type=secret,id=OPENAI_API_KEY,mode=0444,required=true
21
  RUN chmod +x tests.sh && ./tests.sh
22
 
23
  CMD ["streamlit", "run","app.py","--server.port" ,"7860"]
 
17
  WORKDIR $HOME/app
18
 
19
  COPY --chown=user . $HOME/app
 
20
  RUN chmod +x tests.sh && ./tests.sh
21
 
22
  CMD ["streamlit", "run","app.py","--server.port" ,"7860"]
app.py CHANGED
@@ -10,14 +10,27 @@ if "app" not in state:
10
  state.out = ""
11
  st.title("Streamlit using Huggingface Transformers and langchain")
12
  in_area = st.container()
13
- out_area = st.container()
 
14
 
15
 
16
 
17
- def __run_pipline():
18
  out_area.markdown(":green[Running pipline]")
19
  out_area.text(pipline.chain_TI(state.input_text))
20
 
21
 
 
 
 
 
 
 
 
 
 
 
22
  in_area.text_area("input_text", key="input_text")
23
- in_area.button("run", on_click=__run_pipline)
 
 
 
10
  state.out = ""
11
  st.title("Streamlit using Huggingface Transformers and langchain")
12
  in_area = st.container()
13
+ out_area = st.container().empty()
14
+ in_area.empty()
15
 
16
 
17
 
18
+ def __run_TTI():
19
  out_area.markdown(":green[Running pipline]")
20
  out_area.text(pipline.chain_TI(state.input_text))
21
 
22
 
23
+ def __run_CC():
24
+ out_area.markdown(":green[Running pipline]")
25
+ words = state.input_text.rstrip().split()
26
+ if len(words) != 2:
27
+ out_area.error("Please enter two terms")
28
+ else:
29
+ out_area.markdown(":green[Running pipline]")
30
+ out_area.text(pipline.chain_CC({"term1": words[0], "term2": words[1]}))
31
+
32
+
33
  in_area.text_area("input_text", key="input_text")
34
+ tti_button , cc_button = in_area.columns(2)
35
+ tti_button.button("What are you trying to imply?", on_click=__run_TTI)
36
+ cc_button.button("What is the connection between the two terms?", on_click=__run_CC)
pipline.py CHANGED
@@ -4,7 +4,7 @@ from langchain.prompts import load_prompt
4
  import wikipedia
5
  import os
6
 
7
- llm = OpenAI(openai_api_key=os.environ.get("OPENAI_API_KEY"))
8
  # save templates to a file
9
  try_imply_template = """Question:
10
  The user wrote me the following text, what is he trying to imply to me?
 
4
  import wikipedia
5
  import os
6
 
7
+ llm = OpenAI()
8
  # save templates to a file
9
  try_imply_template = """Question:
10
  The user wrote me the following text, what is he trying to imply to me?