Jin Zhu commited on
Commit
8d1f5be
·
1 Parent(s): 3f3b680

Update app.py

Browse files
Files changed (1) hide show
  1. src/app.py +33 -5
src/app.py CHANGED
@@ -6,6 +6,8 @@ from pathlib import Path
6
  # -----------------
7
  APP_DIR = Path(__file__).parent.resolve()
8
 
 
 
9
  # -----------------
10
  # Fix Streamlit Permission Issues
11
  # -----------------
@@ -34,11 +36,37 @@ import streamlit as st
34
  from FineTune.model import ComputeStat
35
  import time
36
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  # -----------------
38
  # Page Configuration
39
  # -----------------
40
  st.set_page_config(
41
- page_title="AdaDetectGPT",
42
  page_icon="🔍",
43
  layout="wide"
44
  )
@@ -113,7 +141,7 @@ from feedback import FeedbackManager
113
  # Initialize Feedback Manager with HF dataset
114
  # 请将 'your-username/your-dataset-name' 替换为您的实际 HF 数据集仓库 ID
115
  # 确保在环境变量中设置了 HF_TOKEN 以访问私有数据集
116
- FEEDBACK_DATASET_ID = os.environ.get('FEEDBACK_DATASET_ID', 'mamba413/user-feedback')
117
  feedback_manager = FeedbackManager(
118
  dataset_repo_id=FEEDBACK_DATASET_ID,
119
  hf_token=os.environ.get('HF_TOKEN'),
@@ -169,7 +197,7 @@ if 'feedback_given' not in st.session_state:
169
  _, col0, _ = st.columns((1, 5, 1))
170
  with col0:
171
  st.markdown(
172
- "<h1 style='text-align: center; color: #0072C3;'>AdaDetectGPT: Adaptive LLM's Texts Detection</h1>",
173
  unsafe_allow_html=True,
174
  )
175
 
@@ -208,10 +236,10 @@ with col1:
208
  with col2:
209
  statistics_ph = st.empty()
210
  statistics_ph.text_input(
211
- label="Statistics",
212
  value="",
213
  disabled=True,
214
- help="Statistics will appear here after clicking the Detect button.",
215
  )
216
 
217
  pvalue_ph = st.empty()
 
6
  # -----------------
7
  APP_DIR = Path(__file__).parent.resolve()
8
 
9
+ account_name = 'mamba413'
10
+
11
  # -----------------
12
  # Fix Streamlit Permission Issues
13
  # -----------------
 
36
  from FineTune.model import ComputeStat
37
  import time
38
 
39
+ st.markdown(
40
+ """
41
+ <style>
42
+ /* Primary button (Detect) */
43
+ div.stButton > button[kind="primary"] {
44
+ background-color: #2a4f7c; /* 学术蓝 */
45
+ border-color: #2a4f7c;
46
+ color: white;
47
+ font-weight: 600;
48
+ }
49
+
50
+ div.stButton > button[kind="primary"]:hover {
51
+ background-color: #1f3a5f; /* hover 深一点 */
52
+ border-color: #1f3a5f;
53
+ color: white;
54
+ }
55
+
56
+ div.stButton > button[kind="primary"]:active {
57
+ background-color: #1b2f4a;
58
+ border-color: #1b2f4a;
59
+ }
60
+ </style>
61
+ """,
62
+ unsafe_allow_html=True
63
+ )
64
+
65
  # -----------------
66
  # Page Configuration
67
  # -----------------
68
  st.set_page_config(
69
+ page_title="DetectGPTPro",
70
  page_icon="🔍",
71
  layout="wide"
72
  )
 
141
  # Initialize Feedback Manager with HF dataset
142
  # 请将 'your-username/your-dataset-name' 替换为您的实际 HF 数据集仓库 ID
143
  # 确保在环境变量中设置了 HF_TOKEN 以访问私有数据集
144
+ FEEDBACK_DATASET_ID = os.environ.get('FEEDBACK_DATASET_ID', f'{account_name}/user-feedback')
145
  feedback_manager = FeedbackManager(
146
  dataset_repo_id=FEEDBACK_DATASET_ID,
147
  hf_token=os.environ.get('HF_TOKEN'),
 
197
  _, col0, _ = st.columns((1, 5, 1))
198
  with col0:
199
  st.markdown(
200
+ "<h1 style='text-align: center; color: #0072C3;'>DetectGPTPro: Super Adaptive LLM's Texts Detection</h1>",
201
  unsafe_allow_html=True,
202
  )
203
 
 
236
  with col2:
237
  statistics_ph = st.empty()
238
  statistics_ph.text_input(
239
+ label="Statistic",
240
  value="",
241
  disabled=True,
242
+ help="Statistic will appear here after clicking the Detect button.",
243
  )
244
 
245
  pvalue_ph = st.empty()