JustKiddo commited on
Commit
ad36a2f
·
verified ·
1 Parent(s): 7b2c79d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -56,9 +56,9 @@ def generate_tokens(text):
56
  output_ids = output.tolist()[0]
57
 
58
  input_tokens_str = tokenizer.convert_ids_to_tokens(input_ids)
59
- output_tokens_str = output_ids
60
 
61
- return " ".join(input_tokens_str), " ".join(output_tokens_str)
62
 
63
  """
64
  For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
@@ -101,15 +101,15 @@ with gr.Blocks() as demo:
101
  with gr.Row():
102
  input_text = gr.Textbox(label="Input text")
103
  input_tokens = gr.Textbox(label="Input tokens")
104
- output_tokens = gr.Textbox(label="Output tokens")
105
 
106
  def update_tokens(input_text):
107
- input_tokens_str, output_tokens_str = generate_tokens(input_text)
108
- return input_tokens_str, output_tokens_str
109
 
110
  input_text.change(update_tokens,
111
  inputs=input_text,
112
- outputs=[input_tokens, output_tokens])
113
 
114
  if __name__ == "__main__":
115
  demo.launch(debug=True)
 
56
  output_ids = output.tolist()[0]
57
 
58
  input_tokens_str = tokenizer.convert_ids_to_tokens(input_ids)
59
+ #output_tokens_str = tokenizer.convert_tokens_to_ids(output_ids)
60
 
61
+ return " ".join(input_tokens_str), " ".join(output_ids)
62
 
63
  """
64
  For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
 
101
  with gr.Row():
102
  input_text = gr.Textbox(label="Input text")
103
  input_tokens = gr.Textbox(label="Input tokens")
104
+ output_ids = gr.Textbox(label="Output tokens")
105
 
106
  def update_tokens(input_text):
107
+ input_tokens_str, output_ids = generate_tokens(input_text)
108
+ return input_tokens_str, output_ids
109
 
110
  input_text.change(update_tokens,
111
  inputs=input_text,
112
+ outputs=[input_tokens, output_ids])
113
 
114
  if __name__ == "__main__":
115
  demo.launch(debug=True)