nikhedward commited on
Commit
4215587
1 Parent(s): 0ca9d1f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -5,7 +5,7 @@ def install(package):
5
  subprocess.check_call([sys.executable, "-m", "pip", "install", package])
6
 
7
  install("transformers")
8
- # install("torch")
9
  install("sentencepiece")
10
  install("gradio")
11
 
@@ -19,12 +19,12 @@ from transformers.models.auto.tokenization_auto import AutoTokenizer
19
  model_name = "deepset/tinyroberta-squad2" # distilled model: "deepset/tinyroberta-squad2", "deepset/xlm-roberta-base-squad2"
20
 
21
  # a) Get predictions
22
- nlp = pipeline('question-answering', model=model_name, tokenizer=model_name)
23
- QA_input = {
24
- 'question': 'Why is model conversion important?',
25
- 'context': 'The option to convert models between FARM and transformers gives freedom to the user and let people easily switch between frameworks.'
26
- }
27
- res = nlp(QA_input)
28
 
29
  # b) Load model & tokenizer
30
  model = AutoModelForQuestionAnswering.from_pretrained(model_name)
 
5
  subprocess.check_call([sys.executable, "-m", "pip", "install", package])
6
 
7
  install("transformers")
8
+ install("torch")
9
  install("sentencepiece")
10
  install("gradio")
11
 
 
19
  model_name = "deepset/tinyroberta-squad2" # distilled model: "deepset/tinyroberta-squad2", "deepset/xlm-roberta-base-squad2"
20
 
21
  # a) Get predictions
22
+ # nlp = pipeline('question-answering', model=model_name, tokenizer=model_name)
23
+ # QA_input = {
24
+ # 'question': 'Why is model conversion important?',
25
+ # 'context': 'The option to convert models between FARM and transformers gives freedom to the user and let people easily switch between frameworks.'
26
+ #}
27
+ #res = nlp(QA_input)
28
 
29
  # b) Load model & tokenizer
30
  model = AutoModelForQuestionAnswering.from_pretrained(model_name)