sashtech commited on
Commit
bac4259
·
verified ·
1 Parent(s): 5bee7e5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -14
app.py CHANGED
@@ -1,25 +1,24 @@
 
1
  from ginger import correct_sentence
2
 
3
  def main():
4
  """
5
  Main application function.
6
- Prompts the user for input and corrects grammar using the Ginger API.
7
  """
8
- while True:
9
- # Get input from the user
10
- text = input("Enter a sentence (or 'q' to quit): ")
11
 
12
- # Exit the loop if the user wants to quit
13
- if text.lower() == 'q':
14
- print("Exiting the application.")
15
- break
 
16
 
17
- # Correct the sentence using the Ginger API
18
- corrected_text = correct_sentence(text)
19
-
20
- # Display the original and corrected sentences
21
- print(f"Original Sentence: {text}")
22
- print(f"Corrected Sentence: {corrected_text}\n")
23
 
24
  if __name__ == "__main__":
25
  main()
 
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()