hidevscommunity commited on
Commit
d00ea24
·
1 Parent(s): df1e7a9

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +77 -0
app.py ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import numpy as np
3
+ import pickle
4
+ import streamlit.components.v1 as components
5
+ from sklearn.feature_extraction.text import CountVectorizer
6
+ cv = CountVectorizer()
7
+ # Load the pickled model
8
+ def load_model():
9
+ return pickle.load(open('Iris_Flower_Classification_RandomForest.pkl', 'rb')) #Load model from notebook
10
+
11
+ # Function for model prediction
12
+ def model_prediction(model, features):
13
+ features = cv.transform([features]).toarray()
14
+ predicted = str(model.predict(features)[0])
15
+ return predicted
16
+
17
+ def app_design():
18
+ # Add input fields for High, Open, and Low values
19
+ image = '21.png' # Load image
20
+ st.image(image, use_column_width=True)
21
+
22
+ st.subheader("Enter the following values:")
23
+
24
+ text= st.text_input("Enter your message")
25
+ # Create a feature list from the user inputs
26
+ features = [[text]] # add features according to notebook
27
+
28
+ # Load the model
29
+ model = load_model()
30
+
31
+ # Make a prediction when the user clicks the "Predict" button
32
+ if st.button('Predict Sarcasm'):
33
+ predicted_value = model_prediction(model, features)
34
+ if predicted_value == 'Sarcasm':
35
+ st.success(f"Your message contains Sarcasm")
36
+ else:
37
+ st.success(f"Your message doesnot contains Sarcasm")
38
+
39
+
40
+
41
+ def about_hidevs():
42
+
43
+ components.html("""
44
+ <div>
45
+ <h4>🚀 Unlock Your Dream Job with HiDevs Community!</h4>
46
+ <p class="subtitle">🔍 Seeking the perfect job? HiDevs Community is your gateway to career success in the tech industry. Explore free expert courses, job-seeking support, and career transformation tips.</p>
47
+ <p class="subtitle">💼 We offer an upskill program in <b>Gen AI, Data Science, Machine Learning</b>, and assist startups in adopting <b>Gen AI</b> at minimal development costs.</p>
48
+ <p class="subtitle">🆓 Best of all, everything we offer is <b>completely free</b>! We are dedicated to helping society.</p>
49
+ <p class="subtitle">Book free of cost 1:1 mentorship on any topic of your choice — <a class="link" href="https://topmate.io/deepakchawla1307">topmate</a></p>
50
+ <p class="subtitle">✨ We dedicate over 30 minutes to each applicant’s resume, LinkedIn profile, mock interview, and upskill program. If you’d like our guidance, check out our services <a class="link" href="https://hidevscommunity.wixsite.com/hidevs">here</a></p>
51
+ <p class="subtitle">💡 Join us now, and turbocharge your career!</p>
52
+ <p class="subtitle"><a class="link" href="https://hidevscommunity.wixsite.com/hidevs" target="__blank">Website</a>
53
+ <a class="link" href="https://www.youtube.com/@HidevsCommunity1307/" target="__blank">YouTube</a>
54
+ <a class="link" href="https://www.instagram.com/hidevs_community/" target="__blank">Instagram</a>
55
+ <a class="link" href="https://medium.com/@hidevscommunity" target="__blank">Medium</a>
56
+ <a class="link" href="https://www.linkedin.com/company/hidevs-community/" target="__blank">LinkedIn</a>
57
+ <a class="link" href="https://github.com/hidevscommunity" target="__blank">GitHub</a></p>
58
+ </div>
59
+ """,
60
+ height=600)
61
+
62
+ def main():
63
+
64
+ # Set the app title and add your website name and logo
65
+ st.set_page_config(
66
+ page_title="Sarcasm Detection",
67
+ page_icon=":chart_with_upwards_trend:",
68
+ )
69
+
70
+ st.title("Welcome to our Sarcasm Detection App!")
71
+
72
+ app_design()
73
+ st.header("About HiDevs Community")
74
+ about_hidevs()
75
+
76
+ if __name__ == '__main__':
77
+ main()