Spaces:
Runtime error
Runtime error
import gradio as gr | |
def generate_ielts_essay(prompt): | |
# You may want to customize the max_length and other parameters according to your needs | |
return "Hello " + prompt + "!!" | |
def generate_or_grade(task, text): | |
if task == "Generate": | |
# Generate an essay | |
# output = generator(text, max_length=500)[0]['generated_text'] | |
return "Hello " + text + "!!" | |
elif task == "Grade": | |
# Simple grading function. Replace with a more sophisticated essay grading algorithm. | |
words = text.split() | |
if len(words) > 200: | |
return "Good" | |
else: | |
return "Poor" | |
iface = gr.Interface( | |
fn=generate_or_grade, | |
inputs=[ | |
gr.inputs.Radio(["Generate", "Grade"], label="Task"), | |
gr.inputs.Textbox(lines=10, placeholder="Enter text...") | |
], | |
outputs="text", | |
title="IELTS Essay Generator and Grader", | |
description="This tool generates a response to an IELTS writing prompt using AI and provides a simple grading.", | |
) | |
iface.launch() | |