import gradio as gr from transformers import pipeline def inference(text): classifier = pipeline("text-classification", model="karanzrk/essayl0") output = classifier(text) return output[0]["label"] # launcher = gr.Interface( # fn=inference, # inputs=gr.Textbox(lines=5, placeholder="Essay here...."), # outputs="text" # ) with gr.Blocks() as demo: gr.Markdown( """ # Welcome to our web app demo Please type your essay in the Input box below, make sure the essay is less than 500 characters!! """ ) inputs = gr.Textbox(label="Input Box",lines = 5, placeholder="Essay here....") button = gr.Button("Grade!") output = gr.Textbox(label="Output Box") button.click(fn=inference, inputs=inputs, outputs = output, api_name="Autograde") demo.launch()