Sarathkumar1304ai commited on
Commit
f863bc0
ยท
verified ยท
1 Parent(s): 540d40e
frontend/__pycache__/about.cpython-312.pyc ADDED
Binary file (1.84 kB). View file
 
frontend/__pycache__/home.cpython-312.pyc ADDED
Binary file (2.15 kB). View file
 
frontend/__pycache__/project.cpython-312.pyc ADDED
Binary file (3.52 kB). View file
 
frontend/about.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+
4
+ def about_me_ui():
5
+ st.title("About Me ๐Ÿ™‹โ€โ™‚๏ธ ")
6
+ st.write("""
7
+ Hello! ๐Ÿ‘‹ I'm **R. Sarath Kumar**, and I'm thrilled to have you here! Iโ€™m a dedicated and passionate professional in **Data Science** and **Machine Learning** ๐Ÿค–.
8
+ With a strong foundation in statistics, machine learning, and MLOps, I love transforming data into valuable insights and building predictive models that solve real-world problems. My work spans across multiple domains, and Iโ€™m always excited to explore new tools and techniques to make data-driven decisions more effective and impactful.
9
+
10
+ Feel free to browse through my projects, where youโ€™ll find some of the most exciting applications of AI and machine learning, and don't hesitate to reach out if youโ€™d like to connect or discuss potential collaborations!
11
+ """)
12
+
13
+
14
+
15
+ st.subheader("Contact Information")
16
+
17
+
18
+ st.write("๐Ÿ”—LinkedIn: [LinkedIn](https://www.linkedin.com/in/r-sarath-kumar-666084257)")
19
+ st.write("๐Ÿ”—Github:[Github](https://www.github.com/sarathkumar1304)")
20
+
21
+
22
+ st.write("๐Ÿ“ง Email: [sarathkumarrathnam@gmail.com](mailto:sarathkumarrathnam@gmail.com)")
23
+
24
+ st.write("๐Ÿ“ž Phone: 7780651312")
25
+
26
+
27
+
frontend/home.py ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+
4
+ def home_ui():
5
+
6
+ # Streamlit app title
7
+ st.title("Transformer-Based Text Classification Project ๐ŸŒŸ")
8
+
9
+ # Objective section
10
+ st.header("๐Ÿ” Objective")
11
+ st.write("""
12
+ The primary objective of this project is to classify text into positive or negative sentiment using a
13
+ **Transformer-based pre-trained model**. This model helps in understanding the sentiment of user-provided text,
14
+ which can be useful in applications like customer feedback analysis, review classification, and more.
15
+ """)
16
+
17
+ # Tools used
18
+ st.header("๐Ÿ› ๏ธ Tools Used")
19
+ st.write("""
20
+ This project leverages the following tools and technologies:
21
+ - **Python**: For data preprocessing and backend logic.
22
+ - **Hugging Face Transformers**: For leveraging pre-trained Transformer models.
23
+ - **PyTorch**: For model operations and predictions.
24
+ - **Docker** (optional): To containerize the application for deployment.
25
+ - **Mlflow** : For model tracking and version control.
26
+ - **Git**: For version control and collaboration.
27
+ - **Streamlit**: To create an interactive and user-friendly UI.
28
+ """)
29
+
30
+ # Architecture section
31
+ st.header("๐Ÿ—๏ธ Project Architecture")
32
+ st.write("""
33
+ The architecture of this project can be summarized in the following flow:
34
+ """)
35
+
36
+ # Display architecture image
37
+ # architecture_image_path = "path_to_your_architecture_image.png" # Replace with your image path
38
+ # st.image(architecture_image_path, caption="Project Architecture", use_column_width=True)
39
+
40
+ # Footer or additional information
41
+ st.write("---")
42
+ st.write("""
43
+ ๐Ÿ’ก This application is designed to showcase the integration of **NLP** and **Machine Learning** with
44
+ an easy-to-use web interface. The predictions are generated in real-time, providing insights into text sentiments.
45
+ """)
frontend/main.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ from streamlit_option_menu import option_menu
4
+ from about import about_me_ui
5
+ from project import project_ui
6
+ from home import home_ui
7
+
8
+
9
+ with st.sidebar:
10
+ selected = option_menu(
11
+ menu_title="Main Menu",
12
+ options=["Home", "Project","About Me"],
13
+ icons=["house", "app-indicator" ,"person-video3"],
14
+ menu_icon="cast",
15
+ default_index=1,
16
+ )
17
+
18
+ if selected == "Home":
19
+ home_ui()
20
+
21
+ if selected == "Project":
22
+ project_ui()
23
+
24
+ if selected == "About Me":
25
+ about_me_ui()
frontend/project.py ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from transformers import pipeline
3
+ from streamlit_echarts import st_echarts
4
+
5
+ def project_ui():
6
+ # Load the pre-trained sentiment analysis model
7
+ model_name = "saved_model"
8
+ classifier = pipeline("sentiment-analysis", model=model_name)
9
+
10
+ # App title and description
11
+ st.title("Transformer-Based Text Classification")
12
+ st.write("""
13
+ This app uses a pre-trained Transformer model to classify text. Enter your text below to get the classification result.
14
+ """)
15
+
16
+ # User input
17
+ user_input = st.text_area("Enter your text here", height=150)
18
+
19
+ # Prediction button
20
+ if st.button("Predict"):
21
+ if user_input.strip():
22
+ try:
23
+ # Perform text classification
24
+ predictions = classifier(user_input)
25
+
26
+ # Extract label and score
27
+ label = predictions[0]['label']
28
+ score = predictions[0]['score']
29
+
30
+ # Calculate positive and negative scores
31
+ if label == 'LABEL_0':
32
+ negative_score = score
33
+ positive_score = 1 - score
34
+ else:
35
+ positive_score = score
36
+ negative_score = 1 - score
37
+
38
+ # Display sentiment prediction and scores
39
+ if label == 'LABEL_0':
40
+ st.error("Prediction: ๐Ÿ˜” Negative")
41
+ else:
42
+ st.success("Prediction: ๐Ÿ˜Š Positive")
43
+
44
+ st.write("### Sentiment Scores")
45
+ st.write(f"Positive Score: {positive_score * 100:.2f}%")
46
+ st.write(f"Negative Score: {negative_score * 100:.2f}%")
47
+
48
+ # Display interactive sentiment analysis indicator
49
+ options = {
50
+ "series": [
51
+ {
52
+ "type": "gauge",
53
+ "startAngle": 180,
54
+ "endAngle": 0,
55
+ "radius": "100%",
56
+ "pointer": {"show": True, "length": "60%", "width": 5},
57
+ "progress": {
58
+ "show": True,
59
+ "overlap": False,
60
+ "roundCap": True,
61
+ "clip": False
62
+ },
63
+ "axisLine": {
64
+ "lineStyle": {
65
+ "width": 10,
66
+ "color": [
67
+ [0.5, "#FF6F61"], # Negative (Red)
68
+ [1, "#6AA84F"] # Positive (Green)
69
+ ]
70
+ }
71
+ },
72
+ "axisTick": {"show": False},
73
+ "splitLine": {"show": False},
74
+ "axisLabel": {"distance": 15, "fontSize": 10},
75
+ "data": [
76
+ {"value": positive_score * 100, "name": "Positive"},
77
+ ],
78
+ "title": {"fontSize": 14},
79
+ "detail": {
80
+ "valueAnimation": True,
81
+ "formatter": "{value}%",
82
+ "fontSize": 12
83
+ },
84
+ "animation": True, # Enable animation
85
+ "animationDuration": 2000, # Duration in ms
86
+ "animationEasing": "cubicOut" # Smooth animation
87
+ }
88
+ ]
89
+ }
90
+
91
+ st.write("### Interactive Sentiment Analysis Indicator")
92
+ st_echarts(options, height="300px")
93
+
94
+ # Warning if confidence is below 60%
95
+ if score < 0.6:
96
+ st.warning("The confidence level of the prediction is below 60%. The result may not be reliable.")
97
+
98
+ except Exception as e:
99
+ st.error(f"An error occurred during prediction: {e}")
100
+ else:
101
+ st.warning("Please enter some text for prediction.")
102
+
103
+ # Run the Streamlit app
104
+ if __name__ == "__main__":
105
+ project_ui()