hidevscommunity commited on
Commit
8f5eb9a
·
verified ·
1 Parent(s): 840bb61

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +90 -0
app.py ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ from sklearn.model_selection import train_test_split
7
+ import pandas as pd
8
+ import nltk
9
+ import re
10
+ from sklearn.naive_bayes import MultinomialNB
11
+
12
+ df = pd.read_csv('language.csv')
13
+ # X will be the features
14
+ X = np.array(df["Text"])
15
+
16
+ # y will be the target variable
17
+ y = np.array(df["language"])
18
+ cv = CountVectorizer()
19
+ # Load the pickled model
20
+
21
+ X = cv.fit_transform(X)
22
+ X_train, X_test, y_train, y_test = train_test_split(X, y,
23
+ test_size=0.33,
24
+ random_state=42)
25
+
26
+ model = MultinomialNB()
27
+ model.fit(X_train, y_train)
28
+ # Function for model prediction
29
+ def model_prediction(features):
30
+ features = cv.transform([features]).toarray()
31
+ Message = str(list(model.predict(features)))
32
+
33
+ return Message
34
+
35
+ def app_design():
36
+ # Add input fields for High, Open, and Low values
37
+ image = '52.png' # Load image
38
+ st.image(image, use_column_width=True)
39
+
40
+ st.subheader("Enter the following values:")
41
+
42
+ text= st.text_input("Enter your text")
43
+ # Create a feature list from the user inputs
44
+ features = text # add features according to notebook
45
+
46
+ # Make a prediction when the user clicks the "Predict" button
47
+ if st.button('Predict Language'):
48
+ predicted_value = model_prediction(features)
49
+ st.success(f"Your Language is {predicted_value[2:-2]}")
50
+
51
+
52
+
53
+
54
+ def about_hidevs():
55
+
56
+ components.html("""
57
+ <div>
58
+ <h4>🚀 Unlock Your Dream Job with HiDevs Community!</h4>
59
+ <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>
60
+ <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>
61
+ <p class="subtitle">🆓 Best of all, everything we offer is <b>completely free</b>! We are dedicated to helping society.</p>
62
+ <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>
63
+ <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>
64
+ <p class="subtitle">💡 Join us now, and turbocharge your career!</p>
65
+ <p class="subtitle"><a class="link" href="https://hidevscommunity.wixsite.com/hidevs" target="__blank">Website</a>
66
+ <a class="link" href="https://www.youtube.com/@HidevsCommunity1307/" target="__blank">YouTube</a>
67
+ <a class="link" href="https://www.instagram.com/hidevs_community/" target="__blank">Instagram</a>
68
+ <a class="link" href="https://medium.com/@hidevscommunity" target="__blank">Medium</a>
69
+ <a class="link" href="https://www.linkedin.com/company/hidevs-community/" target="__blank">LinkedIn</a>
70
+ <a class="link" href="https://github.com/hidevscommunity" target="__blank">GitHub</a></p>
71
+ </div>
72
+ """,
73
+ height=600)
74
+
75
+ def main():
76
+
77
+ # Set the app title and add your website name and logo
78
+ st.set_page_config(
79
+ page_title="Language Detection",
80
+ page_icon=":chart_with_upwards_trend:",
81
+ )
82
+
83
+ st.title("Welcome to our Language Detection App!")
84
+
85
+ app_design()
86
+ st.header("About HiDevs Community")
87
+ about_hidevs()
88
+
89
+ if __name__ == '__main__':
90
+ main()