igoracmorais commited on
Commit
a1c48d3
·
verified ·
1 Parent(s): 77399c5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -9
app.py CHANGED
@@ -5,17 +5,22 @@ import json
5
  data = []
6
 
7
  # Função para adicionar contextos, perguntas e respostas
8
- def add_entry(title, context, question, answer, answer_start, entry_id):
9
  global data
10
  entry = {
11
- "title": title,
12
  "context": context,
13
- "question": question,
14
- "id": entry_id,
15
- "answers": {
16
- "answer_start": [answer_start],
17
- "text": [answer]
18
- }
 
 
 
 
 
 
19
  }
20
  data.append(entry)
21
  return "Entry added!"
@@ -31,7 +36,6 @@ def save_to_json():
31
  # Interface Gradio
32
  with gr.Blocks() as demo:
33
  with gr.Row():
34
- title = gr.Textbox(label="Title")
35
  context = gr.Textbox(lines=5, label="Context")
36
  question = gr.Textbox(lines=2, label="Question")
37
  answer = gr.Textbox(lines=2, label="Answer")
 
5
  data = []
6
 
7
  # Função para adicionar contextos, perguntas e respostas
8
+ def add_entry(context, question, answer, answer_start, entry_id):
9
  global data
10
  entry = {
 
11
  "context": context,
12
+ "qas":[
13
+ {
14
+ "id": entry_id,
15
+ "question": question,
16
+ "answers": [
17
+ {
18
+ "text": answer,
19
+ "answer_start": answer_start
20
+ }
21
+ ]
22
+ }
23
+ ]
24
  }
25
  data.append(entry)
26
  return "Entry added!"
 
36
  # Interface Gradio
37
  with gr.Blocks() as demo:
38
  with gr.Row():
 
39
  context = gr.Textbox(lines=5, label="Context")
40
  question = gr.Textbox(lines=2, label="Question")
41
  answer = gr.Textbox(lines=2, label="Answer")