Habieb143 commited on
Commit
c6a79ea
1 Parent(s): 3c63390

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -16
app.py CHANGED
@@ -1,20 +1,9 @@
1
  import streamlit as st
2
  from transformers import pipeline
3
 
4
- @st.cache(allow_output_mutation=True)
5
- def load_qa_model():
6
- model = pipeline("question-answering")
7
- return model
8
 
9
- qa = load_qa_model()
10
- st.title("Ask Questions about your Text")
11
- sentence = st.text_area('Please paste your article :', height=30)
12
- question = st.text_input("Questions from this article?")
13
- button = st.button("Get me Answers")
14
- max = st.sidebar.slider('Select max', 50, 500, step=10, value=150)
15
- min = st.sidebar.slider('Select min', 10, 450, step=10, value=50)
16
- do_sample = st.sidebar.checkbox("Do sample", value=False)
17
- with st.spinner("Discovering Answers.."):
18
- if button and sentence:
19
- answers = qa(question=question, context=sentence)
20
- st.write(answers['answer'])
 
1
  import streamlit as st
2
  from transformers import pipeline
3
 
4
+ pipe = pipeline("sentiment-analysis")
5
+ text = st.text_area('enter some text')
 
 
6
 
7
+ if text:
8
+ out = pipe(text)
9
+ st.json(out)