Spaces:
Running
Running
ThanaritKanjanametawat
commited on
Commit
·
81ec3b4
1
Parent(s):
bd0c703
FIx output not showing
Browse files
app.py
CHANGED
@@ -5,6 +5,7 @@ import numpy as np
|
|
5 |
|
6 |
# Add a title
|
7 |
st.title('GPT Detection Demo')
|
|
|
8 |
|
9 |
# Add 4 options for 4 models
|
10 |
ModelOption = st.sidebar.selectbox(
|
@@ -13,31 +14,35 @@ ModelOption = st.sidebar.selectbox(
|
|
13 |
)
|
14 |
|
15 |
DatasetOption = st.sidebar.selectbox(
|
16 |
-
'Which Dataset
|
17 |
('OpenGPT', 'CSAbstract'),
|
18 |
)
|
19 |
|
20 |
|
21 |
-
text = st.text_area('Enter text here', '')
|
22 |
|
23 |
if st.button('Generate'):
|
24 |
if ModelOption == 'RobertaSentinel':
|
25 |
if DatasetOption == 'OpenGPT':
|
26 |
result = RobertaSentinelOpenGPTInference(text)
|
|
|
27 |
elif DatasetOption == 'CSAbstract':
|
28 |
result = RobertaSentinelCSAbstractInference(text)
|
|
|
29 |
|
30 |
elif ModelOption == 'RobertaClassifier':
|
31 |
if DatasetOption == 'OpenGPT':
|
32 |
result = RobertaClassifierOpenGPTInference(text)
|
|
|
33 |
elif DatasetOption == 'CSAbstract':
|
34 |
result = RobertaClassifierCSAbstractInference(text)
|
|
|
35 |
|
36 |
Prediction = "Human Written" if not np.argmax(result) else "Machine Generated"
|
37 |
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
|
42 |
|
43 |
|
|
|
5 |
|
6 |
# Add a title
|
7 |
st.title('GPT Detection Demo')
|
8 |
+
st.write("This is a demo for GPT detection. You can use this demo to test the model. The model is trained on two datasets: OpenGPT and CSAbstract. You can choose the model and dataset in the sidebar.")
|
9 |
|
10 |
# Add 4 options for 4 models
|
11 |
ModelOption = st.sidebar.selectbox(
|
|
|
14 |
)
|
15 |
|
16 |
DatasetOption = st.sidebar.selectbox(
|
17 |
+
'Which Dataset the model was trained on?',
|
18 |
('OpenGPT', 'CSAbstract'),
|
19 |
)
|
20 |
|
21 |
|
22 |
+
text = st.text_area('Enter text here (max 500 words)', '')
|
23 |
|
24 |
if st.button('Generate'):
|
25 |
if ModelOption == 'RobertaSentinel':
|
26 |
if DatasetOption == 'OpenGPT':
|
27 |
result = RobertaSentinelOpenGPTInference(text)
|
28 |
+
st.write("Model: RobertaSentinelOpenGPT")
|
29 |
elif DatasetOption == 'CSAbstract':
|
30 |
result = RobertaSentinelCSAbstractInference(text)
|
31 |
+
st.write("Model: RobertaSentinelCSAbstract")
|
32 |
|
33 |
elif ModelOption == 'RobertaClassifier':
|
34 |
if DatasetOption == 'OpenGPT':
|
35 |
result = RobertaClassifierOpenGPTInference(text)
|
36 |
+
st.write("Model: RobertaClassifierOpenGPT")
|
37 |
elif DatasetOption == 'CSAbstract':
|
38 |
result = RobertaClassifierCSAbstractInference(text)
|
39 |
+
st.write("Model: RobertaClassifierCSAbstract")
|
40 |
|
41 |
Prediction = "Human Written" if not np.argmax(result) else "Machine Generated"
|
42 |
|
43 |
+
st.write(f"Prediction: {Prediction} ")
|
44 |
+
st.write(f"Probabilty:", max(result))
|
45 |
+
|
46 |
|
47 |
|
48 |
|