Spaces:
Runtime error
Runtime error
sayanbanerjee32
commited on
Commit
•
3742d38
1
Parent(s):
344074e
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
@@ -21,7 +21,7 @@ regex_pat = data_dict['regex_pat']
|
|
21 |
|
22 |
def encode_decode(text):
|
23 |
ids = encode(text, regex_pat, merges)
|
24 |
-
return ' '.join([str(i) for i in ids]), decode(ids, vocab)
|
25 |
|
26 |
|
27 |
with gr.Blocks() as demo:
|
@@ -43,10 +43,11 @@ with gr.Blocks() as demo:
|
|
43 |
with gr.Row():
|
44 |
encoded = gr.Textbox(label = "Tokens")
|
45 |
decoded = gr.Textbox(label = "Regenerated text")
|
46 |
-
|
|
|
47 |
generate_btn.click(fn = encode_decode, inputs= inputs, outputs = outputs)
|
48 |
|
49 |
-
|
50 |
# demo.launch(debug=True)
|
51 |
|
52 |
if __name__ == '__main__':
|
|
|
21 |
|
22 |
def encode_decode(text):
|
23 |
ids = encode(text, regex_pat, merges)
|
24 |
+
return ' '.join([str(i) for i in ids]), decode(ids, vocab), [(str(i),decode([i], vocab)) for i in ids]
|
25 |
|
26 |
|
27 |
with gr.Blocks() as demo:
|
|
|
43 |
with gr.Row():
|
44 |
encoded = gr.Textbox(label = "Tokens")
|
45 |
decoded = gr.Textbox(label = "Regenerated text")
|
46 |
+
explain = gr.HighlightedText(label = "Mapping tokens to text")
|
47 |
+
outputs = [encoded, decoded, explain]
|
48 |
generate_btn.click(fn = encode_decode, inputs= inputs, outputs = outputs)
|
49 |
|
50 |
+
# # for collab
|
51 |
# demo.launch(debug=True)
|
52 |
|
53 |
if __name__ == '__main__':
|