run480 commited on
Commit
7a1062c
·
verified ·
1 Parent(s): f8b69cb

Update app.py

Browse files

Output tensors and their text representation

Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -176,9 +176,10 @@ def generate(starting_text):
176
  #response = gpt2_tensors
177
  for i, x in enumerate(gpt2_tensors):
178
  response=response+f"{i}: {gpt2_tkn.decode(x, skip_special_tokens=True)}" # Decode tensors into text
179
- return response
180
 
181
  txt=grad.Textbox(lines=1, label="English", placeholder="English Text here")
182
- out=grad.Textbox(lines=1, label="Generated Tensors")
 
183
 
184
- grad.Interface(generate, inputs=txt, outputs=out).launch()
 
176
  #response = gpt2_tensors
177
  for i, x in enumerate(gpt2_tensors):
178
  response=response+f"{i}: {gpt2_tkn.decode(x, skip_special_tokens=True)}" # Decode tensors into text
179
+ return gpt2_tensors, response
180
 
181
  txt=grad.Textbox(lines=1, label="English", placeholder="English Text here")
182
+ out_tensors=grad.Textbox(lines=1, label="Generated Tensors")
183
+ out_text=grad.Textbox(lines=1, label="Generated Text")
184
 
185
+ grad.Interface(generate, inputs=txt, outputs=[out_tensors, out_text]).launch()