| import streamlit as st |
| from PIL import Image |
| import pandas as pd |
| from transformers import pipeline |
|
|
| |
| sentiment_analysis = pipeline("sentiment-analysis", model="chayanee/Detected_img") |
|
|
| |
| st.title("NLP and Image Analysis") |
|
|
| |
| text_input = st.text_area("Enter some text for sentiment analysis:") |
|
|
| |
| uploaded_image = st.file_uploader("Upload an image for analysis", type=["jpg", "jpeg", "png"]) |
|
|
| |
| if st.button("Analyze"): |
| |
| if text_input: |
| sentiment_result = sentiment_analysis(text_input) |
| st.write("Sentiment Analysis Result:") |
| st.write(sentiment_result) |
|
|
| |
| if uploaded_image: |
| |
| image = Image.open(uploaded_image) |
| st.image(image, caption="Uploaded Image", use_column_width=True) |
|
|
| if __name__ == "__main__": |
| main() |
|
|