Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
def summarize_text(text):
|
| 5 |
+
model = pipeline("text-classification", model = "cross-encoder/qnli-electra-base")
|
| 6 |
+
text_input = model(text)
|
| 7 |
+
return text_input
|
| 8 |
+
|
| 9 |
+
def main():
|
| 10 |
+
user_input = st.text_area("Input Text Here")
|
| 11 |
+
if st.button("Sentiment"):
|
| 12 |
+
summary = summarize_text(user_input)
|
| 13 |
+
st.write("Sentiment:")
|
| 14 |
+
st.write(summary)
|
| 15 |
+
|
| 16 |
+
if __name__ == "__main__":
|
| 17 |
+
main()
|