Spaces:
Sleeping
Sleeping
abnerzhang
commited on
Commit
·
3e5ef0f
1
Parent(s):
2ee6302
Update app.py
Browse files
app.py
CHANGED
@@ -1,13 +1,24 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
def
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
iface = gr.Interface(
|
7 |
-
fn=
|
8 |
-
inputs=gr.inputs.Textbox(lines=3, placeholder="Enter IELTS writing prompt here..."),
|
|
|
9 |
outputs="text",
|
10 |
-
title="IELTS Essay Generator",
|
11 |
-
description="This tool generates a response to an IELTS writing prompt using AI.",
|
12 |
)
|
|
|
13 |
iface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
+
def generate_ielts_essay(prompt):
|
4 |
+
# You may want to customize the max_length and other parameters according to your needs
|
5 |
+
return "Hello " + prompt + "!!"
|
6 |
+
|
7 |
+
def grade_essay(essay):
|
8 |
+
# Simple grading function. Replace with a more sophisticated essay grading algorithm.
|
9 |
+
words = essay.split()
|
10 |
+
if len(words) > 200:
|
11 |
+
return "Good"
|
12 |
+
else:
|
13 |
+
return "Poor"
|
14 |
|
15 |
iface = gr.Interface(
|
16 |
+
fn={"Generate": generate_ielts_essay, "Grade": grade_essay},
|
17 |
+
inputs={"Generate": gr.inputs.Textbox(lines=3, placeholder="Enter IELTS writing prompt here..."),
|
18 |
+
"Grade": gr.inputs.Textbox(lines=10, placeholder="Paste the essay text here...")},
|
19 |
outputs="text",
|
20 |
+
title="IELTS Essay Generator and Grader",
|
21 |
+
description="This tool generates a response to an IELTS writing prompt using AI and provides a simple grading.",
|
22 |
)
|
23 |
+
|
24 |
iface.launch()
|