xuandin commited on
Commit
65d40d5
·
verified ·
1 Parent(s): 4fdfda4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -10
app.py CHANGED
@@ -5,7 +5,8 @@ from semviqa.ser.qatc_model import QATCForQuestionAnswering
5
  from semviqa.tvc.model import ClaimModelForClassification
6
  from semviqa.ser.ser_eval import extract_evidence_tfidf_qatc
7
  from semviqa.tvc.tvc_eval import classify_claim
8
- import time # Thêm thư viện time để đo thời gian inference
 
9
 
10
  # Load models with caching
11
  @st.cache_resource()
@@ -89,6 +90,10 @@ st.markdown(
89
  background-color: #f0f2f6;
90
  padding: 20px;
91
  border-radius: 10px;
 
 
 
 
92
  }
93
  .stSidebar .st-expander {
94
  background-color: #ffffff;
@@ -112,7 +117,7 @@ st.markdown(
112
 
113
  # Container for the whole content with dynamic height
114
  with st.container():
115
- st.markdown("<p class='big-title'>SemViQA: Vietnamese Semantic QA for Fact Verification</p>", unsafe_allow_html=True)
116
  st.markdown("<p class='sub-title'>Enter the claim and context to verify its accuracy</p>", unsafe_allow_html=True)
117
 
118
  # Sidebar: Global Settings
@@ -193,14 +198,6 @@ with st.container():
193
  )
194
  evidence_time = time.time() - evidence_start_time
195
 
196
- # Hiển thị evidence trước
197
- st.markdown(f"""
198
- <div class='result-box'>
199
- <p><strong>Evidence:</strong> {evidence}</p>
200
- <p><strong>Evidence Inference Time:</strong> {evidence_time:.2f} seconds</p>
201
- </div>
202
- """, unsafe_allow_html=True)
203
-
204
  # Classify the claim
205
  verdict_start_time = time.time()
206
  verdict = "NEI"
@@ -272,6 +269,14 @@ with st.container():
272
  with tabs[1]:
273
  st.subheader("Verification History")
274
  if st.session_state.history:
 
 
 
 
 
 
 
 
275
  for idx, record in enumerate(reversed(st.session_state.history), 1):
276
  st.markdown(f"**{idx}. Claim:** {record['claim']} \n**Result:** {verdict_icons.get(record['verdict'], '')} {record['verdict']}")
277
  else:
 
5
  from semviqa.tvc.model import ClaimModelForClassification
6
  from semviqa.ser.ser_eval import extract_evidence_tfidf_qatc
7
  from semviqa.tvc.tvc_eval import classify_claim
8
+ import time
9
+ import pandas as pd
10
 
11
  # Load models with caching
12
  @st.cache_resource()
 
90
  background-color: #f0f2f6;
91
  padding: 20px;
92
  border-radius: 10px;
93
+ position: sticky;
94
+ top: 55px; /* Height of the header */
95
+ height: calc(100vh - 75px); /* Adjust height to fit within the viewport */
96
+ overflow-y: auto; /* Enable scrolling within the sidebar if content is too long */
97
  }
98
  .stSidebar .st-expander {
99
  background-color: #ffffff;
 
117
 
118
  # Container for the whole content with dynamic height
119
  with st.container():
120
+ st.markdown("<p class='big-title'>SemViQA: A Semantic Question Answering System for Vietnamese Information Fact-Checking</p>", unsafe_allow_html=True)
121
  st.markdown("<p class='sub-title'>Enter the claim and context to verify its accuracy</p>", unsafe_allow_html=True)
122
 
123
  # Sidebar: Global Settings
 
198
  )
199
  evidence_time = time.time() - evidence_start_time
200
 
 
 
 
 
 
 
 
 
201
  # Classify the claim
202
  verdict_start_time = time.time()
203
  verdict = "NEI"
 
269
  with tabs[1]:
270
  st.subheader("Verification History")
271
  if st.session_state.history:
272
+ # Convert history to DataFrame for easy download
273
+ history_df = pd.DataFrame(st.session_state.history)
274
+ st.download_button(
275
+ label="Download Full History",
276
+ data=history_df.to_csv(index=False).encode('utf-8'),
277
+ file_name="verification_history.csv",
278
+ mime="text/csv",
279
+ )
280
  for idx, record in enumerate(reversed(st.session_state.history), 1):
281
  st.markdown(f"**{idx}. Claim:** {record['claim']} \n**Result:** {verdict_icons.get(record['verdict'], '')} {record['verdict']}")
282
  else: