Spaces:
Build error
Build error
Upload app.py
Browse files
app.py
CHANGED
@@ -4,7 +4,6 @@ import spacy
|
|
4 |
import nltk
|
5 |
import tensorflow as tf
|
6 |
import streamlit as st
|
7 |
-
import streamlit.components.v1 as components
|
8 |
from streamlit_extras.add_vertical_space import add_vertical_space
|
9 |
from bs4 import BeautifulSoup
|
10 |
from gensim.models import Word2Vec
|
@@ -38,27 +37,6 @@ def streamlit_config():
|
|
38 |
add_vertical_space(4)
|
39 |
|
40 |
|
41 |
-
def text_color_change(input_file):
|
42 |
-
|
43 |
-
# Add style to change the text color to white
|
44 |
-
styled_html = f"""
|
45 |
-
<!DOCTYPE html>
|
46 |
-
<html>
|
47 |
-
<head>
|
48 |
-
<style>
|
49 |
-
body {{
|
50 |
-
color: white;
|
51 |
-
}}
|
52 |
-
</style>
|
53 |
-
</head>
|
54 |
-
<body>
|
55 |
-
{input_file}
|
56 |
-
</body>
|
57 |
-
</html>
|
58 |
-
"""
|
59 |
-
return styled_html
|
60 |
-
|
61 |
-
|
62 |
def text_extract_from_html(html_file):
|
63 |
|
64 |
# Read the uploaded HTML file
|
@@ -149,7 +127,13 @@ def prediction(input_file):
|
|
149 |
# Find the Confidence
|
150 |
confidence = round(np.max(prediction)*100, 2)
|
151 |
|
152 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
153 |
|
154 |
|
155 |
|
@@ -169,19 +153,6 @@ input_file = st.file_uploader('Upload an HTML file', type='html')
|
|
169 |
|
170 |
if input_file is not None:
|
171 |
|
172 |
-
|
173 |
-
add_vertical_space(1)
|
174 |
-
html_content = input_file.read().decode('utf-8')
|
175 |
-
html_content = text_color_change(html_content)
|
176 |
-
components.html(html=html_content, width=700, height=300, scrolling=True)
|
177 |
-
|
178 |
-
predicted_class, confidence = prediction(input_file)
|
179 |
|
180 |
-
add_vertical_space(1)
|
181 |
-
st.markdown(f'<h4 style="text-align: center; color: orange;">{confidence}% Match Found</h4>',
|
182 |
-
unsafe_allow_html=True)
|
183 |
-
|
184 |
-
add_vertical_space(1)
|
185 |
-
st.markdown(f'<h3 style="text-align: center; color: green;">{predicted_class}</h3>',
|
186 |
-
unsafe_allow_html=True)
|
187 |
|
|
|
4 |
import nltk
|
5 |
import tensorflow as tf
|
6 |
import streamlit as st
|
|
|
7 |
from streamlit_extras.add_vertical_space import add_vertical_space
|
8 |
from bs4 import BeautifulSoup
|
9 |
from gensim.models import Word2Vec
|
|
|
37 |
add_vertical_space(4)
|
38 |
|
39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
def text_extract_from_html(html_file):
|
41 |
|
42 |
# Read the uploaded HTML file
|
|
|
127 |
# Find the Confidence
|
128 |
confidence = round(np.max(prediction)*100, 2)
|
129 |
|
130 |
+
add_vertical_space(2)
|
131 |
+
st.markdown(f'<h4 style="text-align: center; color: orange;">{confidence}% Match Found</h4>',
|
132 |
+
unsafe_allow_html=True)
|
133 |
+
|
134 |
+
add_vertical_space(1)
|
135 |
+
st.markdown(f'<h3 style="text-align: center; color: green;">{predicted_class}</h3>',
|
136 |
+
unsafe_allow_html=True)
|
137 |
|
138 |
|
139 |
|
|
|
153 |
|
154 |
if input_file is not None:
|
155 |
|
156 |
+
prediction(input_file)
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
158 |
|