SarowarSaurav commited on
Commit
e0c2f9e
·
verified ·
1 Parent(s): 24acff2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -10
app.py CHANGED
@@ -1,13 +1,12 @@
1
  import gradio as gr
2
  from transformers import pipeline
3
 
 
4
  pipe = pipeline("question-answering", model="google-bert/bert-large-uncased-whole-word-masking-finetuned-squad")
 
5
  # Define the function to answer questions
6
  def get_answer(text):
7
- result = qa_pipeline({
8
- "question": text,
9
- "context": knowledge_base_text
10
- })
11
  return result["answer"]
12
 
13
  # Define the Gradio interface
@@ -41,9 +40,6 @@ knowledge_base_text = """
41
  - for SAP , wifi , network related issue , you should contact Md. Monirul Islam & his contact number 01730372426
42
  """
43
 
44
-
45
-
46
-
47
  iface = gr.Interface(
48
  fn=chatbot_interface,
49
  inputs="text",
@@ -51,9 +47,7 @@ iface = gr.Interface(
51
  css="footer{display:none !important}",
52
  title="British American Tobacco Bangladesh",
53
  description="- powered by IDT",
54
- theme='Taithrah/Minimal'
55
-
56
  )
57
 
58
-
59
  iface.launch()
 
1
  import gradio as gr
2
  from transformers import pipeline
3
 
4
+ # Use a pipeline as a high-level helper
5
  pipe = pipeline("question-answering", model="google-bert/bert-large-uncased-whole-word-masking-finetuned-squad")
6
+
7
  # Define the function to answer questions
8
  def get_answer(text):
9
+ result = pipe(question=text, context=knowledge_base_text)
 
 
 
10
  return result["answer"]
11
 
12
  # Define the Gradio interface
 
40
  - for SAP , wifi , network related issue , you should contact Md. Monirul Islam & his contact number 01730372426
41
  """
42
 
 
 
 
43
  iface = gr.Interface(
44
  fn=chatbot_interface,
45
  inputs="text",
 
47
  css="footer{display:none !important}",
48
  title="British American Tobacco Bangladesh",
49
  description="- powered by IDT",
50
+ theme='compact'
 
51
  )
52
 
 
53
  iface.launch()