Upload app.py
Browse files
app.py
CHANGED
|
@@ -3,31 +3,27 @@ from PIL import Image
|
|
| 3 |
import pandas as pd
|
| 4 |
from transformers import pipeline
|
| 5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
# Create a sentiment analysis pipeline
|
| 7 |
sentiment_analysis = pipeline("sentiment-analysis", model="chayanee/Detected_img")
|
| 8 |
|
| 9 |
# Set the title for your Streamlit app
|
| 10 |
-
st.title("
|
| 11 |
-
|
| 12 |
-
# Text Input Widget
|
| 13 |
-
text_input = st.text_area("Enter some text for sentiment analysis:")
|
| 14 |
|
| 15 |
# Image Upload Widget
|
| 16 |
-
uploaded_image = st.file_uploader("Upload an image for
|
| 17 |
|
| 18 |
# Perform sentiment analysis when the user clicks a button
|
| 19 |
-
if st.button("
|
| 20 |
-
# Perform sentiment analysis on the text
|
| 21 |
-
if text_input:
|
| 22 |
-
sentiment_result = sentiment_analysis(text_input)
|
| 23 |
-
st.write("Sentiment Analysis Result:")
|
| 24 |
-
st.write(sentiment_result)
|
| 25 |
-
|
| 26 |
# Analyze the uploaded image if available
|
| 27 |
if uploaded_image:
|
| 28 |
# Display the uploaded image
|
| 29 |
image = Image.open(uploaded_image)
|
| 30 |
st.image(image, caption="Uploaded Image", use_column_width=True)
|
| 31 |
|
|
|
|
| 32 |
if __name__ == "__main__":
|
| 33 |
-
|
|
|
|
| 3 |
import pandas as pd
|
| 4 |
from transformers import pipeline
|
| 5 |
|
| 6 |
+
import streamlit as st
|
| 7 |
+
from PIL import Image
|
| 8 |
+
from transformers import pipeline
|
| 9 |
+
|
| 10 |
# Create a sentiment analysis pipeline
|
| 11 |
sentiment_analysis = pipeline("sentiment-analysis", model="chayanee/Detected_img")
|
| 12 |
|
| 13 |
# Set the title for your Streamlit app
|
| 14 |
+
st.title("Object Detection")
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
# Image Upload Widget
|
| 17 |
+
uploaded_image = st.file_uploader("Upload an image for Detection", type=["jpg", "jpeg", "png"])
|
| 18 |
|
| 19 |
# Perform sentiment analysis when the user clicks a button
|
| 20 |
+
if st.button("Detection"):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
# Analyze the uploaded image if available
|
| 22 |
if uploaded_image:
|
| 23 |
# Display the uploaded image
|
| 24 |
image = Image.open(uploaded_image)
|
| 25 |
st.image(image, caption="Uploaded Image", use_column_width=True)
|
| 26 |
|
| 27 |
+
# Run the Streamlit app
|
| 28 |
if __name__ == "__main__":
|
| 29 |
+
st.run()
|