Graimond commited on
Commit
e07d22d
·
1 Parent(s): fca0aef

description update app.py

Browse files

gradio interface description update

Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -8,20 +8,20 @@ df.drop_duplicates(inplace=True, ignore_index=True)
8
 
9
  model = SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2')
10
 
11
- def run_question(domanda):
12
  somme = []
13
  for jdx, j in enumerate(list(df.Question)):
14
  somme.append(float(util.pytorch_cos_sim(
15
  model.encode(list(df.Question)[jdx], convert_to_tensor=True),
16
- model.encode(domanda, convert_to_tensor=True))))
17
  if round(max(somme)*100) < 70:
18
- return 'Sorry, could you paraphrase your question? I quide didn\'t catch that...'
19
  else:
20
  return df.loc[somme.index(max(somme)), 'Answer']
21
 
22
  gradio.Interface(run_question, "text", "text",
23
  title='Introducing C.A.BOT',
24
- description='This is Cabot, the Consular Affairs bot. Give it a try asking').launch()
25
 
26
 
27
 
 
8
 
9
  model = SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2')
10
 
11
+ def run_question(Question):
12
  somme = []
13
  for jdx, j in enumerate(list(df.Question)):
14
  somme.append(float(util.pytorch_cos_sim(
15
  model.encode(list(df.Question)[jdx], convert_to_tensor=True),
16
+ model.encode(Question, convert_to_tensor=True))))
17
  if round(max(somme)*100) < 70:
18
+ return 'I\'m sorry, I\'m not sure I understood your question. Could you try again?'
19
  else:
20
  return df.loc[somme.index(max(somme)), 'Answer']
21
 
22
  gradio.Interface(run_question, "text", "text",
23
  title='Introducing C.A.BOT',
24
+ description='Hi! This is Cabot, the Consular Affairs bot.\nI will help you answer your questions about the Citizen Services that you can request at the Consular Sections within U.S. Embassy Rome.').launch()
25
 
26
 
27