Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- app.py +22 -0
- requirements.txt +4 -0
app.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
# from setfit import SetFitModel
|
3 |
+
|
4 |
+
# Cache the model loading process to optimize performance on Hugging Face Spaces
|
5 |
+
# @st.cache_resource
|
6 |
+
# def load_model():
|
7 |
+
# return SetFitModel.from_pretrained("Tryfonas/setfit-paraphrase-mpnet-base-v2-sst2")
|
8 |
+
|
9 |
+
# model = load_model()
|
10 |
+
|
11 |
+
st.title("Text Sentiment Analysis ππ")
|
12 |
+
|
13 |
+
# Create a text input for a single sentence
|
14 |
+
user_input = st.text_input("Enter a sentence for sentiment analysis:", placeholder="I love this!")
|
15 |
+
|
16 |
+
# Add a button to trigger predictions
|
17 |
+
if st.button("Analyze Sentiment"):
|
18 |
+
if user_input:
|
19 |
+
# Temporarily show the input instead of model predictions
|
20 |
+
st.write(f"Prediction for '{user_input}': This is a placeholder response.")
|
21 |
+
else:
|
22 |
+
st.write("Please enter a sentence to analyze.")
|
requirements.txt
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
streamlit
|
2 |
+
setfit
|
3 |
+
transformers
|
4 |
+
sentence-transformers
|