File size: 1,816 Bytes
4f3b124
22b1f21
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c196f31
 
 
 
22b1f21
 
 
 
 
a0df025
 
 
 
22b1f21
 
 
 
a0df025
22b1f21
 
 
a0df025
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
29
30
31
32
33
34
35
36
37
38
39
40
import gradio as gr
def generate_essay(prompt, band_score):
    # replace this with code to generate essay text using AI
    return "Generated essay text"

def grade_essay(essay_text):
    # replace this with code to grade the essay text using AI
    return "Band Score: 7.5"

with gr.Blocks() as app:
    prompt = gr.Textbox(label="IELTS Writing Prompt", 
                        lines=3, 
                        placeholder="Enter IELTS writing prompt here...",
                        value="IELTS Essay Task 1: Department Stores and Online Stores in Australia\n\n"
                              "The table gives information about department and online stores in Australia in 2011.\n"
                              "Summarise the information by selecting and reporting the main features, and make comparisons where relevant.\n\n"
                              "Department Stores    Online Stores\n"
                              "Number of Businesses      67 368\n"
                              "Profit (AUD)             807 863\n"
                              "Sales Revenue (AUD)   12,700 13,400\n"
                              "Growth                  .4%  .6%")
    
    essay = gr.Textbox(label="Generated Essay", 
                       lines=10, 
                       placeholder="Generated essay will appear here...")

    for band_score in range(6, 10):
        btn = gr.Button(f"Generate Band {band_score} Essay")
        btn.click(generate_essay, inputs=prompt, outputs=essay)
    
    grade = gr.Button("Grade")
    grade_result = gr.Textbox(label="Grade Result", 
                              lines=2, 
                              placeholder="Graded result will appear here...")
                              
    grade.click(grade_essay, inputs=essay, outputs=grade_result)

app.launch()