Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -99,47 +99,3 @@ if st.button("Analyze Sentiment"):
|
|
| 99 |
st.write("---")
|
| 100 |
st.write("EdgeWise Content Moderation Bot - Powered by AI")
|
| 101 |
|
| 102 |
-
|
| 103 |
-
'''
|
| 104 |
-
import streamlit as st
|
| 105 |
-
import pandas as pd
|
| 106 |
-
import random
|
| 107 |
-
|
| 108 |
-
# Introduction and Disclaimer
|
| 109 |
-
st.title("Edge Device Content Moderation Bot")
|
| 110 |
-
st.write("""
|
| 111 |
-
This application is designed for content moderation and works best with local deployment.
|
| 112 |
-
For more details, visit https://github.com/Ashar086/EdgeWise
|
| 113 |
-
""")
|
| 114 |
-
|
| 115 |
-
# Load the CSV to get the sentiment classes
|
| 116 |
-
filename = "synData.csv"
|
| 117 |
-
df = pd.read_csv(filename, names=["sentiment", "text"], encoding="utf-8", encoding_errors="replace")
|
| 118 |
-
|
| 119 |
-
# Get unique sentiments from the CSV file
|
| 120 |
-
sentiments = sorted(df.sentiment.unique())
|
| 121 |
-
sentiment_string = "\n ".join(sentiments)
|
| 122 |
-
|
| 123 |
-
# Disclaimer about the classes
|
| 124 |
-
st.write(f"The bot is able to detect the following text categories: {', '.join(sentiments)}")
|
| 125 |
-
|
| 126 |
-
# Function to simulate text analysis
|
| 127 |
-
def random_response():
|
| 128 |
-
return "This is a random response. The actual analysis is best performed locally."
|
| 129 |
-
|
| 130 |
-
# Streamlit Chat Interface
|
| 131 |
-
st.write("### Enter text to analyze:")
|
| 132 |
-
|
| 133 |
-
# User input
|
| 134 |
-
user_input = st.text_area("Your text here...")
|
| 135 |
-
|
| 136 |
-
if user_input:
|
| 137 |
-
with st.spinner("Analyzing sentiment..."):
|
| 138 |
-
# Simulate a random response
|
| 139 |
-
sentiment_detected = random.sample(sentiments,1)[0]
|
| 140 |
-
|
| 141 |
-
# Display the result
|
| 142 |
-
st.write(f"Detected text category: **{sentiment_detected}**")
|
| 143 |
-
st.write("This is a random response. The actual analysis is best performed locally.")
|
| 144 |
-
|
| 145 |
-
'''
|
|
|
|
| 99 |
st.write("---")
|
| 100 |
st.write("EdgeWise Content Moderation Bot - Powered by AI")
|
| 101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|