Furkan Akkurt commited on
Commit
c500598
1 Parent(s): 08e357c

change output to json

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -4,7 +4,8 @@ import json
4
 
5
  def tokenize(Sentence):
6
  response = bap_preprocessing.tokenize(Sentence)
7
- return response
 
8
 
9
  with gr.Blocks() as demo:
10
  gr.Markdown(
@@ -13,7 +14,7 @@ with gr.Blocks() as demo:
13
  """
14
  )
15
  input_s = gr.Textbox(placeholder="Sentence to be tokenized.", label="Sentence")
16
- output = gr.Textbox(label="Tokens")
17
  submit = gr.Button(text="Tokenize")
18
  submit.click(fn=tokenize, inputs=input_s, outputs=output)
19
  examples = gr.Examples([
 
4
 
5
  def tokenize(Sentence):
6
  response = bap_preprocessing.tokenize(Sentence)
7
+ result = json.dumps(response)
8
+ return result
9
 
10
  with gr.Blocks() as demo:
11
  gr.Markdown(
 
14
  """
15
  )
16
  input_s = gr.Textbox(placeholder="Sentence to be tokenized.", label="Sentence")
17
+ output = gr.JSON(label="Tokens")
18
  submit = gr.Button(text="Tokenize")
19
  submit.click(fn=tokenize, inputs=input_s, outputs=output)
20
  examples = gr.Examples([