savan360 commited on
Commit
617f7ab
·
verified ·
1 Parent(s): 2a9c43f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -1,13 +1,13 @@
1
  import gradio as gr
2
  from transformers import pipeline
3
 
4
- # Load a Question Answering model
5
  qa_pipeline = pipeline("question-answering", model="deepset/roberta-base-squad2")
6
 
7
  def get_answer(question):
8
- # Define a context for factual answers
9
  context = """
10
- New Delhi is the capital of India. India is a country in South Asia and is the seventh-largest country by land area.
11
  """
12
  answer = qa_pipeline(question=question, context=context)
13
  return answer["answer"]
 
1
  import gradio as gr
2
  from transformers import pipeline
3
 
4
+ # Load a question-answering model instead of a text generator
5
  qa_pipeline = pipeline("question-answering", model="deepset/roberta-base-squad2")
6
 
7
  def get_answer(question):
8
+ # Define a factual context
9
  context = """
10
+ Washington, D.C. is the capital of the United States of America.
11
  """
12
  answer = qa_pipeline(question=question, context=context)
13
  return answer["answer"]