Spaces:
Running
Running
Update main.py
Browse files
main.py
CHANGED
@@ -55,14 +55,13 @@ if all([
|
|
55 |
# st.session_state.gpt_detector_result = ''
|
56 |
# st.session_state.gpt_detector_probability = [1, 0]
|
57 |
|
58 |
-
st.session_state.bert_gpt_result = [{'label': '', 'score': 1}]
|
59 |
|
60 |
st.session_state.untrue_detector_result = ''
|
61 |
st.session_state.untrue_detector_probability = 1
|
62 |
|
63 |
st.session_state.bert_disinfo_result = [{'label': '', 'score': 1}]
|
64 |
|
65 |
-
|
66 |
|
67 |
content = load_content()
|
68 |
if 'loaded' not in st.session_state:
|
@@ -103,8 +102,7 @@ if st.session_state.agree:
|
|
103 |
# st.session_state.gpt_detector_result = st.session_state.gpt_detector.predict(user_tfidf_disinformation)[0]
|
104 |
# st.session_state.gpt_detector_probability = st.session_state.gpt_detector.predict_proba(user_tfidf_disinformation)[0]
|
105 |
|
106 |
-
|
107 |
-
|
108 |
user_tfidf_untrue_inf = st.session_state.tfidf_vectorizer_untrue_inf.transform([user_input])
|
109 |
st.session_state.untrue_detector_result = st.session_state.untrue_detector.predict(user_tfidf_untrue_inf)[0]
|
110 |
st.session_state.untrue_detector_probability = st.session_state.untrue_detector.predict_proba(user_tfidf_untrue_inf)[0]
|
@@ -112,6 +110,8 @@ if st.session_state.agree:
|
|
112 |
|
113 |
st.session_state.bert_disinfo_result = st.session_state.bert_disinfo(user_input)
|
114 |
|
|
|
|
|
115 |
|
116 |
|
117 |
# if st.session_state.gpt_detector_result == 1:
|
@@ -123,15 +123,7 @@ if st.session_state.agree:
|
|
123 |
# str(round(st.session_state.gpt_detector_probability[0] * 100, 2)) +
|
124 |
# content['gpt_no_proba'][st.session_state.lang], icon="✅")
|
125 |
|
126 |
-
|
127 |
-
st.warning(content['bert_gpt_1'][st.session_state.lang] +
|
128 |
-
str(round(st.session_state.bert_gpt_result[0]['score'] * 100, 2)) +
|
129 |
-
content['bert_gpt_2'][st.session_state.lang], icon = "⚠️")
|
130 |
-
else:
|
131 |
-
st.success(content['bert_human_1'][st.session_state.lang] +
|
132 |
-
str(round(st.session_state.bert_gpt_result[0]['score'] * 100, 2)) +
|
133 |
-
content['bert_human_2'][st.session_state.lang], icon="✅")
|
134 |
-
|
135 |
if st.session_state.untrue_detector_result == 0:
|
136 |
st.warning(content['untrue_getect_yes'][st.session_state.lang] +
|
137 |
str(round(st.session_state.untrue_detector_probability * 100, 2)) +
|
@@ -150,6 +142,16 @@ if st.session_state.agree:
|
|
150 |
str(round(st.session_state.bert_disinfo_result[0]['score'] * 100, 2)) +
|
151 |
content['bert_no_2'][st.session_state.lang], icon="✅")
|
152 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
153 |
|
154 |
st.info(content['disinformation_definition'][st.session_state.lang], icon="ℹ️")
|
155 |
|
|
|
55 |
# st.session_state.gpt_detector_result = ''
|
56 |
# st.session_state.gpt_detector_probability = [1, 0]
|
57 |
|
|
|
58 |
|
59 |
st.session_state.untrue_detector_result = ''
|
60 |
st.session_state.untrue_detector_probability = 1
|
61 |
|
62 |
st.session_state.bert_disinfo_result = [{'label': '', 'score': 1}]
|
63 |
|
64 |
+
st.session_state.bert_gpt_result = [{'label': '', 'score': 1}]
|
65 |
|
66 |
content = load_content()
|
67 |
if 'loaded' not in st.session_state:
|
|
|
102 |
# st.session_state.gpt_detector_result = st.session_state.gpt_detector.predict(user_tfidf_disinformation)[0]
|
103 |
# st.session_state.gpt_detector_probability = st.session_state.gpt_detector.predict_proba(user_tfidf_disinformation)[0]
|
104 |
|
105 |
+
|
|
|
106 |
user_tfidf_untrue_inf = st.session_state.tfidf_vectorizer_untrue_inf.transform([user_input])
|
107 |
st.session_state.untrue_detector_result = st.session_state.untrue_detector.predict(user_tfidf_untrue_inf)[0]
|
108 |
st.session_state.untrue_detector_probability = st.session_state.untrue_detector.predict_proba(user_tfidf_untrue_inf)[0]
|
|
|
110 |
|
111 |
st.session_state.bert_disinfo_result = st.session_state.bert_disinfo(user_input)
|
112 |
|
113 |
+
st.session_state.bert_gpt_result = st.session_state.bert_gpt(user_input)
|
114 |
+
|
115 |
|
116 |
|
117 |
# if st.session_state.gpt_detector_result == 1:
|
|
|
123 |
# str(round(st.session_state.gpt_detector_probability[0] * 100, 2)) +
|
124 |
# content['gpt_no_proba'][st.session_state.lang], icon="✅")
|
125 |
|
126 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
if st.session_state.untrue_detector_result == 0:
|
128 |
st.warning(content['untrue_getect_yes'][st.session_state.lang] +
|
129 |
str(round(st.session_state.untrue_detector_probability * 100, 2)) +
|
|
|
142 |
str(round(st.session_state.bert_disinfo_result[0]['score'] * 100, 2)) +
|
143 |
content['bert_no_2'][st.session_state.lang], icon="✅")
|
144 |
|
145 |
+
if st.session_state.bert_gpt_result[0]['label'] == 'LABEL_1':
|
146 |
+
st.warning(content['bert_gpt_1'][st.session_state.lang] +
|
147 |
+
str(round(st.session_state.bert_gpt_result[0]['score'] * 100, 2)) +
|
148 |
+
content['bert_gpt_2'][st.session_state.lang], icon = "⚠️")
|
149 |
+
else:
|
150 |
+
st.success(content['bert_no_1'][st.session_state.lang] +
|
151 |
+
str(round(st.session_state.bert_gpt_result[0]['score'] * 100, 2)) +
|
152 |
+
content['bert_no_2'][st.session_state.lang], icon="✅")
|
153 |
+
|
154 |
+
|
155 |
|
156 |
st.info(content['disinformation_definition'][st.session_state.lang], icon="ℹ️")
|
157 |
|