Spaces:
Running
Running
Update main.py
Browse files
main.py
CHANGED
@@ -53,7 +53,7 @@ if all([
|
|
53 |
st.session_state.gpt_detector_probability = [1, 0]
|
54 |
|
55 |
st.session_state.untrue_detector_result = ''
|
56 |
-
st.session_state.untrue_detector_probability =
|
57 |
|
58 |
st.session_state.bert_result = [{'label': '', 'score': 1}]
|
59 |
|
@@ -99,6 +99,7 @@ if st.session_state.agree:
|
|
99 |
user_tfidf_untrue_inf = st.session_state.tfidf_vectorizer_untrue_inf.transform([user_input])
|
100 |
st.session_state.untrue_detector_result = st.session_state.untrue_detector.predict(user_tfidf_untrue_inf)[0]
|
101 |
st.session_state.untrue_detector_probability = st.session_state.untrue_detector.predict_proba(user_tfidf_untrue_inf)[0]
|
|
|
102 |
|
103 |
st.session_state.bert_result = st.session_state.bert(user_input)
|
104 |
|
@@ -113,11 +114,11 @@ if st.session_state.agree:
|
|
113 |
|
114 |
if st.session_state.untrue_detector_result == 1:
|
115 |
st.warning(content['untrue_getect_yes'][st.session_state.lang] +
|
116 |
-
str(round(st.session_state.untrue_detector_probability
|
117 |
content['untrue_yes_proba'][st.session_state.lang], icon="⚠️")
|
118 |
else:
|
119 |
st.success(content['untrue_getect_no'][st.session_state.lang] +
|
120 |
-
str(round(st.session_state.untrue_detector_probability
|
121 |
content['untrue_no_proba'][st.session_state.lang], icon="✅")
|
122 |
|
123 |
if st.session_state.bert_result[0]['label'] == 'LABEL_1':
|
|
|
53 |
st.session_state.gpt_detector_probability = [1, 0]
|
54 |
|
55 |
st.session_state.untrue_detector_result = ''
|
56 |
+
st.session_state.untrue_detector_probability = 1
|
57 |
|
58 |
st.session_state.bert_result = [{'label': '', 'score': 1}]
|
59 |
|
|
|
99 |
user_tfidf_untrue_inf = st.session_state.tfidf_vectorizer_untrue_inf.transform([user_input])
|
100 |
st.session_state.untrue_detector_result = st.session_state.untrue_detector.predict(user_tfidf_untrue_inf)[0]
|
101 |
st.session_state.untrue_detector_probability = st.session_state.untrue_detector.predict_proba(user_tfidf_untrue_inf)[0]
|
102 |
+
st.session_state.untrue_detector_probability = max(st.session_state.untrue_detector_probability[0], st.session_state.untrue_detector_probability[1])
|
103 |
|
104 |
st.session_state.bert_result = st.session_state.bert(user_input)
|
105 |
|
|
|
114 |
|
115 |
if st.session_state.untrue_detector_result == 1:
|
116 |
st.warning(content['untrue_getect_yes'][st.session_state.lang] +
|
117 |
+
str(round(st.session_state.untrue_detector_probability * 100, 2)) +
|
118 |
content['untrue_yes_proba'][st.session_state.lang], icon="⚠️")
|
119 |
else:
|
120 |
st.success(content['untrue_getect_no'][st.session_state.lang] +
|
121 |
+
str(round(st.session_state.untrue_detector_probability * 100, 2)) +
|
122 |
content['untrue_no_proba'][st.session_state.lang], icon="✅")
|
123 |
|
124 |
if st.session_state.bert_result[0]['label'] == 'LABEL_1':
|