ThanaritKanjanametawat commited on
Commit
20cc32e
1 Parent(s): 2bb8a76

fix bug and remove model option

Browse files
Files changed (1) hide show
  1. app.py +28 -16
app.py CHANGED
@@ -5,14 +5,14 @@ import numpy as np
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. There are 3 variations of the model, The model was trained on CHEAT, GPABenchmark, OpenGPT datasets. They are all in the domain of Scientific Abstract. You can choose dataset variation of the model on the sidebar.")
9
  # st.write("Reference on how we built Roberta Sentinel: https://arxiv.org/abs/2305.07969")
10
 
11
- # Add 4 options for 4 models
12
- ModelOption = st.sidebar.selectbox(
13
- 'Which Model do you want to use?',
14
- ('RobertaClassifier'),
15
- )
16
 
17
  DatasetOption = st.sidebar.selectbox(
18
  'Which Dataset the model was trained on?',
@@ -22,6 +22,8 @@ DatasetOption = st.sidebar.selectbox(
22
 
23
  text = st.text_area('Enter text here (max 512 words)', '')
24
 
 
 
25
  if st.button('Generate'):
26
  # if ModelOption == 'RobertaSentinel':
27
  # if DatasetOption == 'OpenGPT':
@@ -31,16 +33,26 @@ if st.button('Generate'):
31
  # result = RobertaSentinelCSAbstractInference(text)
32
  # st.write("Model: RobertaSentinelCSAbstract")
33
 
34
- if ModelOption == 'RobertaClassifier':
35
- if DatasetOption == 'OpenGPT':
36
- result = RobertaClassifierOpenGPTInference(text)
37
- st.write("Model: RobertaClassifierOpenGPT")
38
- elif DatasetOption == 'GPABenchmark':
39
- result = RobertaClassifierGPABenchmarkInference(text)
40
- st.write("Model: RobertaClassifierGPABenchmark")
41
- elif DatasetOption == 'CHEAT':
42
- result = RobertaClassifierCHEATInference(text)
43
- st.write("Model: RobertaClassifierCHEAT")
 
 
 
 
 
 
 
 
 
 
44
 
45
 
46
  Prediction = "Human Written" if not np.argmax(result) else "Machine Generated"
 
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. There are 3 variations of the Roberta Classifier Model, The model was trained on CHEAT, GPABenchmark, OpenGPT datasets. They are all in the domain of Scientific Abstract. You can choose dataset variation of the model on the sidebar.")
9
  # st.write("Reference on how we built Roberta Sentinel: https://arxiv.org/abs/2305.07969")
10
 
11
+ # # Add 4 options for 4 models
12
+ # ModelOption = st.sidebar.selectbox(
13
+ # 'Which Model do you want to use?',
14
+ # ('RobertaClassifier'),
15
+ # )
16
 
17
  DatasetOption = st.sidebar.selectbox(
18
  'Which Dataset the model was trained on?',
 
22
 
23
  text = st.text_area('Enter text here (max 512 words)', '')
24
 
25
+
26
+
27
  if st.button('Generate'):
28
  # if ModelOption == 'RobertaSentinel':
29
  # if DatasetOption == 'OpenGPT':
 
33
  # result = RobertaSentinelCSAbstractInference(text)
34
  # st.write("Model: RobertaSentinelCSAbstract")
35
 
36
+ # if ModelOption == 'RobertaClassifier':
37
+ # if DatasetOption == 'OpenGPT':
38
+ # result = RobertaClassifierOpenGPTInference(text)
39
+ # st.write("Model: RobertaClassifierOpenGPT")
40
+ # elif DatasetOption == 'GPABenchmark':
41
+ # result = RobertaClassifierGPABenchmarkInference(text)
42
+ # st.write("Model: RobertaClassifierGPABenchmark")
43
+ # elif DatasetOption == 'CHEAT':
44
+ # result = RobertaClassifierCHEATInference(text)
45
+ # st.write("Model: RobertaClassifierCHEAT")
46
+
47
+ if DatasetOption == 'OpenGPT':
48
+ result = RobertaClassifierOpenGPTInference(text)
49
+ st.write("Model: RobertaClassifierOpenGPT")
50
+ elif DatasetOption == 'GPABenchmark':
51
+ result = RobertaClassifierGPABenchmarkInference(text)
52
+ st.write("Model: RobertaClassifierGPABenchmark")
53
+ elif DatasetOption == 'CHEAT':
54
+ result = RobertaClassifierCHEATInference(text)
55
+ st.write("Model: RobertaClassifierCHEAT")
56
 
57
 
58
  Prediction = "Human Written" if not np.argmax(result) else "Machine Generated"