File size: 824 Bytes
42262aa 5d205bf f31c1ef 79a896b f31c1ef a31a32d 5d205bf a31a32d 5d205bf f31c1ef 5d205bf e6fc461 5d205bf e6fc461 eacb895 5d205bf |
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 |
import gradio as gr
#gr.Interface.load("models/bigscience/bloom").launch()
api = gr.Interface.load("models/bigscience/bloom")
def change_textbox(choice, textin):
if choice == "Expository":
return textin[:-50] + api(textin[-50:])
elif choice == "Narrative":
return textin[:-50] + api(textin[-50:])
else:
return textin[:-50] + api(textin[-50:])
with gr.Blocks() as block:
radio = gr.Radio(
["Expository", "Narrative", "Opinion"], label="What kind of essay would you like to write?"
)
textin = gr.Textbox(lines=2, interactive=True)
textin.update(lines=8, visible=True)
textout = gr.Textbox(lines=2, interactive=True)
textout.update(lines=8, visible=True)
radio.change(fn=change_textbox, inputs=[radio, textin], outputs=textout)
block.launch() |