Pavankalyan commited on
Commit
4c51458
1 Parent(s): a98ef80

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -1
app.py CHANGED
@@ -2,6 +2,13 @@ import gradio as gr
2
  import pandas as pd
3
  from retrieval import *
4
  import os
 
 
 
 
 
 
 
5
 
6
 
7
  hf_writer = gr.HuggingFaceDatasetSaver('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', "Pavankalyan/chitti_data")
@@ -20,7 +27,12 @@ def chitti(query):
20
  repeated_answers_indices.append(sorted_indices[i])
21
  for idx in repeated_answers_indices:
22
  answers_re_table.pop(idx)
23
- return [answers_re_table[0],answers_re_table[1]]
 
 
 
 
 
24
 
25
  demo = gr.Interface(
26
  fn=chitti,
 
2
  import pandas as pd
3
  from retrieval import *
4
  import os
5
+ from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline
6
+
7
+ model_name = "deepset/deberta-v3-large-squad2"
8
+
9
+ # a) Get predictions
10
+ nlp = pipeline('question-answering', model=model_name, tokenizer=model_name)
11
+
12
 
13
 
14
  hf_writer = gr.HuggingFaceDatasetSaver('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', "Pavankalyan/chitti_data")
 
27
  repeated_answers_indices.append(sorted_indices[i])
28
  for idx in repeated_answers_indices:
29
  answers_re_table.pop(idx)
30
+
31
+ QA_input = {'question': query,'context': answers_re_table[0]}
32
+ res1 = str(nlp(QA_input))
33
+ QA_input = {'question': query,'context': answers_re_table[1]}
34
+ res2 = str(nlp(QA_input))
35
+ return [res1,res2]
36
 
37
  demo = gr.Interface(
38
  fn=chitti,