Spaces:
Sleeping
Sleeping
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) | |