sashtech commited on
Commit
2fc5fd9
·
verified ·
1 Parent(s): f4a7bc7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -16
app.py CHANGED
@@ -1,24 +1,23 @@
1
- import sys
2
- from ginger import correct_sentence
3
 
4
- def main():
5
  """
6
- Main application function.
7
- Accepts input via command-line arguments and corrects grammar using the Ginger API.
8
  """
9
- if len(sys.argv) < 2:
10
- print("Please provide a sentence as an argument.")
11
- sys.exit(1)
12
 
13
- # Combine all command-line arguments into one sentence
14
- text = ' '.join(sys.argv[1:])
 
 
 
 
 
 
15
 
16
- # Correct the sentence using the Ginger API
17
- corrected_text = correct_sentence(text)
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()