import gradio as gr | |
def topn_tokens(sequence, n): | |
chars = [] | |
for char in sequence: | |
chars.append(char) | |
return chars | |
demo = gr.Interface( | |
topn_tokens, | |
[ | |
"text", | |
gr.Dropdown(["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20"]), | |
], | |
"dataframe", | |
description="Choose a number between 1-20 to display n tokens", | |
) | |
if __name__ == "__main__": | |
demo.launch() |