Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,24 +1,23 @@
|
|
| 1 |
-
import
|
| 2 |
-
from ginger import
|
| 3 |
|
| 4 |
-
def
|
| 5 |
"""
|
| 6 |
-
|
| 7 |
-
Accepts input via command-line arguments and corrects grammar using the Ginger API.
|
| 8 |
"""
|
| 9 |
-
|
| 10 |
-
print("Please provide a sentence as an argument.")
|
| 11 |
-
sys.exit(1)
|
| 12 |
|
| 13 |
-
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
-
#
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
# Display the original and corrected sentences
|
| 20 |
-
print(f"Original Sentence: {text}")
|
| 21 |
-
print(f"Corrected Sentence: {corrected_text}")
|
| 22 |
|
| 23 |
if __name__ == "__main__":
|
| 24 |
main()
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from ginger import get_corrections # Assuming ginger.py has the get_corrections function
|
| 3 |
|
| 4 |
+
def correct_sentence(text):
|
| 5 |
"""
|
| 6 |
+
Function to correct the sentence using Ginger API or logic.
|
|
|
|
| 7 |
"""
|
| 8 |
+
return get_corrections(text)
|
|
|
|
|
|
|
| 9 |
|
| 10 |
+
# Create the Gradio Interface
|
| 11 |
+
def main():
|
| 12 |
+
# Set up Gradio input/output interface
|
| 13 |
+
interface = gr.Interface(
|
| 14 |
+
fn=correct_sentence, # Function to process the input
|
| 15 |
+
inputs=gr.inputs.Textbox(lines=2, placeholder="Enter a sentence to correct..."), # Input box
|
| 16 |
+
outputs=gr.outputs.Textbox(label="Corrected Sentence") # Output box
|
| 17 |
+
)
|
| 18 |
|
| 19 |
+
# Launch the Gradio app
|
| 20 |
+
interface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
if __name__ == "__main__":
|
| 23 |
main()
|