File size: 833 Bytes
44eb66e
 
 
 
2e43611
44eb66e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 transformers import pipeline

def inference(text):
    classifier = pipeline("text-classification", model="karanzrk/bert-IELTS")
    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()