File size: 1,055 Bytes
c83b762
47aaf42
 
1c041ec
47aaf42
1c041ec
c83b762
1c041ec
 
 
d850c57
3c40360
 
 
1c041ec
 
d850c57
11a95cf
d850c57
dedbd51
1c041ec
 
11a95cf
 
 
 
 
 
 
 
 
 
d850c57
11a95cf
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import subprocess
import torch
import streamlit as st
from streamlit import session_state as state
import streamlit_ace
import pipline

if "app" not in state:
    state.app = "model"
    state.out = ""
in_area = st.container()
out_area = st.container()
in_area.title("Streamlit using Huggingface Transformers and langchain")
out_area.header("Output")



def __run_TTI():
    out_area.markdown(":green[Running pipline]")
    out_area.text(pipline.chain_TI(state.input_text))


def __run_CC():
    out_area.markdown(":green[Running pipline]")
    words = state.input_text.rstrip().split()
    if len(words) != 2:
        out_area.error("Please enter two terms")
    else:
        out_area.markdown(":green[Running pipline]")
        out_area.text(pipline.chain_CC({"term1": words[0], "term2": words[1]}))


in_area.text_area("input_text", key="input_text")
tti_button , cc_button = in_area.columns(2)
tti_button.button("What are you trying to imply?", on_click=__run_TTI)
cc_button.button("What is the connection between the two terms?", on_click=__run_CC)