Spaces:
Sleeping
Sleeping
change layout
Browse files
app.py
CHANGED
|
@@ -10,27 +10,64 @@ if "app" not in state:
|
|
| 10 |
state.out = ""
|
| 11 |
in_area = st.container()
|
| 12 |
out_area = st.container()
|
| 13 |
-
in_area.title("
|
| 14 |
out_area.header("Output")
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
def __run_TTI():
|
| 19 |
-
out_area.
|
| 20 |
-
|
|
|
|
| 21 |
|
| 22 |
|
| 23 |
def __run_CC():
|
| 24 |
-
out_area.
|
| 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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
|
| 33 |
-
in_area.text_area("
|
| 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)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
state.out = ""
|
| 11 |
in_area = st.container()
|
| 12 |
out_area = st.container()
|
| 13 |
+
in_area.title("Demo using langchain and streamlit")
|
| 14 |
out_area.header("Output")
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
def __run_TTI():
|
| 19 |
+
with out_area.empty():
|
| 20 |
+
out_area.markdown(":green[Running pipline]")
|
| 21 |
+
out_area.write(pipline.chain_TI(state.input_text)['text'])
|
| 22 |
|
| 23 |
|
| 24 |
def __run_CC():
|
| 25 |
+
with out_area.empty():
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
out_area.markdown(":green[Running pipline]")
|
| 27 |
+
words = state.input_text.rstrip().split()
|
| 28 |
+
if len(words) != 2:
|
| 29 |
+
out_area.error("Please enter two terms")
|
| 30 |
+
else:
|
| 31 |
+
out_area.write(pipline.chain_CC({"term1": words[0], "term2": words[1]})['text'])
|
| 32 |
|
| 33 |
|
| 34 |
+
in_area.text_area("enter text", key="input_text")
|
| 35 |
tti_button , cc_button = in_area.columns(2)
|
| 36 |
tti_button.button("What are you trying to imply?", on_click=__run_TTI)
|
| 37 |
cc_button.button("What is the connection between the two terms?", on_click=__run_CC)
|
| 38 |
+
with st.expander("code", expanded=False):
|
| 39 |
+
st.code("""
|
| 40 |
+
import pipline
|
| 41 |
+
|
| 42 |
+
if "app" not in state:
|
| 43 |
+
state.app = "model"
|
| 44 |
+
state.out = ""
|
| 45 |
+
in_area = st.container()
|
| 46 |
+
out_area = st.container()
|
| 47 |
+
in_area.title("Demo using langchain and streamlit")
|
| 48 |
+
out_area.header("Output")
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
def __run_TTI():
|
| 53 |
+
with out_area.empty():
|
| 54 |
+
out_area.markdown(":green[Running pipline]")
|
| 55 |
+
out_area.write(pipline.chain_TI(state.input_text)['text'])
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
def __run_CC():
|
| 59 |
+
with out_area.empty():
|
| 60 |
+
out_area.markdown(":green[Running pipline]")
|
| 61 |
+
words = state.input_text.rstrip().split()
|
| 62 |
+
if len(words) != 2:
|
| 63 |
+
out_area.error("Please enter two terms")
|
| 64 |
+
else:
|
| 65 |
+
out_area.write(pipline.chain_CC({"term1": words[0], "term2": words[1]})['text'])
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
in_area.text_area("enter text", key="input_text")
|
| 69 |
+
tti_button , cc_button = in_area.columns(2)
|
| 70 |
+
tti_button.button("What are you trying to imply?", on_click=__run_TTI)
|
| 71 |
+
cc_button.button("What is the connection between the two terms?", on_click=__run_CC)
|
| 72 |
+
|
| 73 |
+
""",language="python")
|