Abdelkareem
commited on
Commit
•
456ebb9
1
Parent(s):
9842eb6
added req, streamlit app
Browse files- app.py +15 -0
- requirements.txt +3 -0
app.py
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
st.title("Hugging Face Demo")
|
5 |
+
text = st.text_input("Enter text to analyze")
|
6 |
+
|
7 |
+
st.cache_resource
|
8 |
+
def get_model():
|
9 |
+
return pipeline("sentiment-analysis")
|
10 |
+
|
11 |
+
model = get_model()
|
12 |
+
if text:
|
13 |
+
result = model(text)
|
14 |
+
st.write("Sentiment : ",result[0]["label"])
|
15 |
+
st.write("Confidence:",result[0]["score"])
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
streamlit
|
2 |
+
transformers
|
3 |
+
torch
|