Spaces:
Sleeping
Sleeping
import base64 | |
import streamlit as st | |
# Function to get base64 string from an image file | |
def get_base64(file_path): | |
with open(file_path, "rb") as file: | |
base64_bytes = base64.b64encode(file.read()) | |
base64_string = base64_bytes.decode("utf-8") | |
return base64_string | |
# Function to set background image | |
def set_background(png_file): | |
bin_str = get_base64(png_file) | |
page_bg_img = ( | |
""" | |
<style> | |
.stApp { | |
background-image: url("data:image/png;base64,%s"); | |
background-size: auto; | |
} | |
</style> | |
""" | |
% bin_str | |
) | |
st.markdown(page_bg_img, unsafe_allow_html=True) | |
# Set background image | |
set_background("tg_toxic.png") | |
title_html = """<p style='font-size: 50px; color: black;'>Toxicity Assessment of User Comments</p>""" | |
st.markdown(title_html, unsafe_allow_html=True) | |
# Title and text with styled hyperlink | |
st.write( | |
"""<p style='font-size: 18px; color: black;'>Used model: rubert-tiny-toxicity</p> | |
<p style='font-size: 18px; color: black;'>Accuracy:</p> | |
<p style='font-size: 18px; color: black;'>Pretrained model: 82%</p> | |
<p style='font-size: 18px; color: black;'>After training on user's data: 90%</p> | |
<a href='https://t.me/toxicity_assessment12345_bot' style='font-size: 18px; color: black; text-decoration: underline;'>Link: Toxicity Assessment Bot</a> | |
""", | |
unsafe_allow_html=True, | |
) | |