File size: 869 Bytes
c83b762
47aaf42
 
1c041ec
47aaf42
1c041ec
 
c83b762
1c041ec
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3fd8457
1c041ec
 
 
 
 
 
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
import subprocess
import torch
import streamlit as st
from streamlit import session_state as state
import streamlit_ace
import model
import pipline

if "app" not in state:
    state.app = "model"
    # state.input_text = "This is the input text."
    # state.word = "input"
    state.out = ""

st.title("Streamlit using Huggingface Transformers and langchain")

def __run_pipline():
    st.text(f"input_text: {state.input_text}\nword: {state.word}")
    st.markdown(":green[Running pipline]")
    st.text(pipline.pipeline(state.input_text, state.word))

def __run_model():
    st.text(f"input_text: {state.input_text}")
    st.markdown(":green[Running model]")
    st.text(model.run(state.input_text))


st.text_area("input_text", key="input_text")
st.text_input("word", key="word")
st.button("pip line", on_click=__run_pipline)
st.button("model", on_click=__run_model)