File size: 694 Bytes
83472e2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import gradio as gr
from ngram_text_gen import (
    generate_output as ngram_text_gen,
    NGRAM_TEXT_GEN_EXAMPLES,
)

ngram_generate = gr.Interface(
    fn=ngram_text_gen,
    inputs=[
        gr.Slider(minimum=2, maximum=4, value=2, step=1, label="N-gram"),
        gr.Textbox(label="Input text"),
        gr.Number(label="Token length", value=10),
    ],
    outputs=[
        gr.Textbox(label="Generated text"),
        gr.HTML(label="Other possible outputs"),
    ],
    examples=NGRAM_TEXT_GEN_EXAMPLES,
    title="N-gram Text Generator",
    description="Generate text using N-grams.",
    allow_flagging="never",
)

with gr.Blocks() as demo:
    ngram_generate.render()

demo.launch()