anakin87 commited on
Commit
274b354
1 Parent(s): 5f65095

little fixes

Browse files
Rock_fact_checker.py CHANGED
@@ -60,7 +60,7 @@ def main():
60
  # Unfortunately necessary as the Random statement button is _below_ the textbox
61
  # Adapted for Streamlit>=1.12
62
  if hasattr(st, 'scriptrunner'):
63
- raise st.scriptrunner.script_runner.RerunException(st.scriptrunner.script_requests.RerunData(None))
64
  else:
65
  raise st.runtime.scriptrunner.script_runner.RerunException(
66
  st.runtime.scriptrunner.script_requests.RerunData("")
 
60
  # Unfortunately necessary as the Random statement button is _below_ the textbox
61
  # Adapted for Streamlit>=1.12
62
  if hasattr(st, 'scriptrunner'):
63
+ raise st.scriptrunner.script_runner.RerunException(st.scriptrunner.script_requests.RerunData(""))
64
  else:
65
  raise st.runtime.scriptrunner.script_runner.RerunException(
66
  st.runtime.scriptrunner.script_requests.RerunData("")
app_utils/backend_utils.py CHANGED
@@ -84,8 +84,8 @@ def query(statement: str, retriever_top_k: int = 5):
84
  break
85
 
86
  results["agg_entailment_info"] = {
87
- "contradiction": round(agg_con / scores, 2),
88
- "neutral": round(agg_neu / scores, 2),
89
- "entailment": round(agg_ent / scores, 2),
90
  }
91
  return results
 
84
  break
85
 
86
  results["agg_entailment_info"] = {
87
+ "contradiction": float(round(agg_con / scores, 2)),
88
+ "neutral": float(round(agg_neu / scores, 2)),
89
+ "entailment": float(round(agg_ent / scores, 2)),
90
  }
91
  return results
app_utils/config.py CHANGED
@@ -9,8 +9,9 @@ RETRIEVER_MODEL = "sentence-transformers/msmarco-distilbert-base-tas-b"
9
  RETRIEVER_MODEL_FORMAT = "sentence_transformers"
10
  RETRIEVER_TOP_K = 5
11
 
12
- try:
 
 
 
13
  NLI_MODEL = st.secrets['NLI_MODEL']
14
- except:
15
- NLI_MODEL = "valhalla/distilbart-mnli-12-1"
16
  print(f'Used NLI model: {NLI_MODEL}')
 
9
  RETRIEVER_MODEL_FORMAT = "sentence_transformers"
10
  RETRIEVER_TOP_K = 5
11
 
12
+ # In HF Space, we use microsoft/deberta-v2-xlarge-mnli
13
+ # for local testing, a smaller model is better
14
+ NLI_MODEL = "valhalla/distilbart-mnli-12-1"
15
+ if hasattr(st, 'secrets'):
16
  NLI_MODEL = st.secrets['NLI_MODEL']
 
 
17
  print(f'Used NLI model: {NLI_MODEL}')
data/statements.txt CHANGED
@@ -38,7 +38,7 @@ Dave Grohl played in Nirvana and Foo Fighters
38
  John Michael Stipe was part of the R.E.M.
39
  Eric Clapton did some gigs with Dire Straits
40
  Mark Knopfler plays drums
41
- "La Bamba" is a hit by Ritchie Valens
42
  Nico took part in the Velvet Underground
43
  David Bowie appears in Twin Peaks
44
  The Cure made dark songs
 
38
  John Michael Stipe was part of the R.E.M.
39
  Eric Clapton did some gigs with Dire Straits
40
  Mark Knopfler plays drums
41
+ Ritchie Valens sang "La Bamba"
42
  Nico took part in the Velvet Underground
43
  David Bowie appears in Twin Peaks
44
  The Cure made dark songs