Mayureshd commited on
Commit
6108c6b
1 Parent(s): 62051ca

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -28
app.py CHANGED
@@ -42,31 +42,34 @@ q[2] = "What time is it going to happen?"
42
  QA_input = [{} for i in range(3)]
43
  res = [{} for i in range(3)]
44
 
45
-
46
- sentence=st.text_area("Enter your sentence")
47
-
48
- for i in range(3):
49
- QA_input[i] = {
50
- 'question': q[i],
51
- 'context': sentence
52
- }
53
- res[i] = nlp(QA_input[i])
54
- a[i] = res[i]['answer']
55
-
56
- a1 = a[0].lower()
57
- a1s = set(a1.split())
58
- sus = set(suspicious_words)
59
- cw = a1s.intersection(sus)
60
-
61
- if len(cw) != 0:
62
- st.write("The crime detected is: ",a[0])
63
- if len(a[1]) != 0:
64
- st.write("The location of crime detected is: ",a[1])
65
- elif len(a[1]) == 0:
66
- st.write("No location detected")
67
- if len(a[2]) != 0:
68
- st.write("The time of crime detected is: ",a[2])
69
- elif len(a[2]) == 0:
70
- st.write("No time detected")
71
- elif len(cw) == 0:
72
- st.write("No crime detected")
 
 
 
 
42
  QA_input = [{} for i in range(3)]
43
  res = [{} for i in range(3)]
44
 
45
+ df = pd.read_excel('senti.xlsx')
46
+
47
+ parsed_column = df['sentences'].to_list()
48
+
49
+ print(parsed_column)
50
+ for sentence in parsed_column:
51
+ for i in range(3):
52
+ QA_input[i] = {
53
+ 'question': q[i],
54
+ 'context': sentence
55
+ }
56
+ res[i] = nlp(QA_input[i])
57
+ a[i] = res[i]['answer']
58
+
59
+ a1 = a[0].lower()
60
+ a1s = set(a1.split())
61
+ sus = set(suspicious_words)
62
+ cw = a1s.intersection(sus)
63
+
64
+ if len(cw) != 0:
65
+ st.write("The crime detected is: ",a[0])
66
+ if len(a[1]) != 0:
67
+ st.write("The location of crime detected is: ",a[1])
68
+ elif len(a[1]) == 0:
69
+ st.write("No location detected")
70
+ if len(a[2]) != 0:
71
+ st.write("The time of crime detected is: ",a[2])
72
+ elif len(a[2]) == 0:
73
+ st.write("No time detected")
74
+ elif len(cw) == 0:
75
+ st.write("No crime detected")