Spaces:
Runtime error
Runtime error
Commit
·
22b1f21
1
Parent(s):
11901df
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
def generate_essay(prompt, band_score):
|
2 |
+
# replace this with code to generate essay text using AI
|
3 |
+
return "Generated essay text"
|
4 |
+
|
5 |
+
def grade_essay(essay_text):
|
6 |
+
# replace this with code to grade the essay text using AI
|
7 |
+
return "Band Score: 7.5"
|
8 |
+
|
9 |
+
with gr.Blocks() as app:
|
10 |
+
prompt = gr.Textbox(label="IELTS Writing Prompt",
|
11 |
+
lines=3,
|
12 |
+
placeholder="Enter IELTS writing prompt here...",
|
13 |
+
value="IELTS Essay Task 1: Department Stores and Online Stores in Australia\n\n"
|
14 |
+
"The table gives information about department and online stores in Australia in 2011.\n"
|
15 |
+
"Summarise the information by selecting and reporting the main features, and make comparisons where relevant.\n\n"
|
16 |
+
"Department Stores Online Stores\n"
|
17 |
+
"Number of Businesses 67 368\n"
|
18 |
+
"Profit (AUD) 807 863\n"
|
19 |
+
"Sales Revenue (AUD) 12,700 13,400\n"
|
20 |
+
"Growth .4% .6%")
|
21 |
+
|
22 |
+
essay = gr.Textbox(label="Generated Essay",
|
23 |
+
lines=10,
|
24 |
+
placeholder="Generated essay will appear here...")
|
25 |
+
|
26 |
+
grade = gr.Button("Grade")
|
27 |
+
grade_result = gr.Textbox(label="Grade Result",
|
28 |
+
lines=2,
|
29 |
+
placeholder="Graded result will appear here...")
|
30 |
+
|
31 |
+
grade.click(grade_essay, inputs=essay, outputs=grade_result)
|
32 |
+
|
33 |
+
for band_score in range(6, 10):
|
34 |
+
btn = gr.Button(f"Generate Band {band_score} Essay")
|
35 |
+
btn.click(generate_essay, inputs=prompt, outputs=essay)
|
36 |
+
|
37 |
+
app.launch()
|