Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,7 +9,7 @@ from transformers import AutoProcessor, AutoModelForZeroShotImageClassification
|
|
| 9 |
pipe = pipeline("summarization", model="google/pegasus-xsum")
|
| 10 |
agepipe = pipeline("image-classification", model="dima806/facial_age_image_detection")
|
| 11 |
imgpipe = pipeline("zero-shot-image-classification", model="openai/clip-vit-base-patch32")
|
| 12 |
-
|
| 13 |
|
| 14 |
st.title("NLP APP")
|
| 15 |
option = st.sidebar.selectbox(
|
|
@@ -48,7 +48,14 @@ elif option == "Image Classification":
|
|
| 48 |
st.write(f"Label: {result['label']}, Score: {result['score']}")
|
| 49 |
else:
|
| 50 |
st.write("Please upload an image file and enter class names.")
|
| 51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
else:
|
| 54 |
st.title("None")
|
|
|
|
| 9 |
pipe = pipeline("summarization", model="google/pegasus-xsum")
|
| 10 |
agepipe = pipeline("image-classification", model="dima806/facial_age_image_detection")
|
| 11 |
imgpipe = pipeline("zero-shot-image-classification", model="openai/clip-vit-base-patch32")
|
| 12 |
+
emopipe = pipeline("text-classification", model="michellejieli/emotion_text_classifier")
|
| 13 |
|
| 14 |
st.title("NLP APP")
|
| 15 |
option = st.sidebar.selectbox(
|
|
|
|
| 48 |
st.write(f"Label: {result['label']}, Score: {result['score']}")
|
| 49 |
else:
|
| 50 |
st.write("Please upload an image file and enter class names.")
|
| 51 |
+
elif option == "Emotion Detection":
|
| 52 |
+
st.title("Detect your emotion")
|
| 53 |
+
text=st.text_area("Enter your text")
|
| 54 |
+
if st.button("Submit"):
|
| 55 |
+
if text:
|
| 56 |
+
st.write("Emotion : ",emopipe(text)["label"])
|
| 57 |
+
else:
|
| 58 |
+
st.write("Please enter text.")
|
| 59 |
|
| 60 |
else:
|
| 61 |
st.title("None")
|