Update app.py
Browse files
app.py
CHANGED
|
@@ -25,20 +25,21 @@ suspicious_words = [
|
|
| 25 |
"saboteur", "suicide", "discreet", "hide", "action", "profile", "alert", "vigilant", "clandestine", "riot", "arms", "deal"
|
| 26 |
]
|
| 27 |
|
| 28 |
-
questions = ["What event is going to take place?", "Where is it going to happen", "What time is it going to happen?"]
|
| 29 |
-
|
| 30 |
# Initialize Streamlit app
|
| 31 |
st.title("Crime Detection App")
|
| 32 |
|
| 33 |
# Load data
|
| 34 |
-
df = pd.read_excel('
|
| 35 |
parsed_column = df['sentences'].to_list()
|
| 36 |
|
| 37 |
# Process sentences and store results
|
| 38 |
output_data = {'Crime Detected': [], 'Location Detected': [], 'Time Detected': []}
|
| 39 |
|
| 40 |
for sentence in parsed_column:
|
| 41 |
-
answers = nlp(
|
|
|
|
|
|
|
|
|
|
| 42 |
cw = set(answers[0]['answer'].lower().split()) & set(suspicious_words)
|
| 43 |
|
| 44 |
if cw:
|
|
|
|
| 25 |
"saboteur", "suicide", "discreet", "hide", "action", "profile", "alert", "vigilant", "clandestine", "riot", "arms", "deal"
|
| 26 |
]
|
| 27 |
|
|
|
|
|
|
|
| 28 |
# Initialize Streamlit app
|
| 29 |
st.title("Crime Detection App")
|
| 30 |
|
| 31 |
# Load data
|
| 32 |
+
df = pd.read_excel('senti.xlsx')
|
| 33 |
parsed_column = df['sentences'].to_list()
|
| 34 |
|
| 35 |
# Process sentences and store results
|
| 36 |
output_data = {'Crime Detected': [], 'Location Detected': [], 'Time Detected': []}
|
| 37 |
|
| 38 |
for sentence in parsed_column:
|
| 39 |
+
answers = nlp({'question': "What event is going to take place?", 'context': sentence},
|
| 40 |
+
{'question': "Where is it going to happen", 'context': sentence},
|
| 41 |
+
{'question': "What time is it going to happen?", 'context': sentence})
|
| 42 |
+
|
| 43 |
cw = set(answers[0]['answer'].lower().split()) & set(suspicious_words)
|
| 44 |
|
| 45 |
if cw:
|