Spaces:
Sleeping
Sleeping
File size: 755 Bytes
25f3b40 |
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 |
import gradio as gr
from transformers import pipeline
# Initialize the spelling correction pipeline with max_new_tokens parameter
spelling_correction_pipe = pipeline("text2text-generation", model="Elalimy/english_spelling_correction", max_new_tokens=100)
# Define the spelling correction function
def correct_spelling(text):
# Perform spelling correction
corrected_text = spelling_correction_pipe(text)[0]['generated_text'].strip()
return corrected_text
# Create the Gradio interface
iface = gr.Interface(
fn=correct_spelling,
inputs="text",
outputs="text",
title="Spelling Correction",
description="Enter a text to get the corrected spelling."
)
# Launch the Gradio app
if __name__ == "__main__":
iface.launch()
|