acecalisto3 commited on
Commit
4aec078
·
verified ·
1 Parent(s): bb5c686

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -14
app.py CHANGED
@@ -2,7 +2,6 @@ import os
2
  import subprocess
3
  import random
4
  import json
5
- import tkinter as tk
6
  from datetime import datetime
7
 
8
  from huggingface_hub import InferenceClient, cached_download, hf_hub_url
@@ -243,7 +242,7 @@ def run(self):
243
  except KeyboardInterrupt:
244
  print("\nApplication stopped by user.")
245
 
246
- def run(self):
247
  print("Welcome to the Python App Builder!")
248
  print("Type 'help' to see the available commands.")
249
  print("-" * 50)
@@ -251,19 +250,26 @@ def run(self):
251
  while True:
252
  try:
253
  input_text = input("Enter input: ")
 
 
 
 
 
254
  except EOFError:
255
  print("Error: Input reading interrupted. Please provide valid input.")
256
- continue
257
-
258
- output, system_message = self.process_input(input_text)
259
- if output:
260
- print(output)
261
- if system_message:
262
- print(system_message)
263
- except KeyboardInterrupt:
264
- print("\nApplication stopped by user.")
265
 
266
  def main():
267
- app = App()
268
- print(f"===== Application Startup at {datetime.now().strftime('%Y-%m-%d %H:%M:%S')} =====")
269
- app.run()
 
 
 
 
 
 
 
2
  import subprocess
3
  import random
4
  import json
 
5
  from datetime import datetime
6
 
7
  from huggingface_hub import InferenceClient, cached_download, hf_hub_url
 
242
  except KeyboardInterrupt:
243
  print("\nApplication stopped by user.")
244
 
245
+ def run(self):
246
  print("Welcome to the Python App Builder!")
247
  print("Type 'help' to see the available commands.")
248
  print("-" * 50)
 
250
  while True:
251
  try:
252
  input_text = input("Enter input: ")
253
+ output, system_message = self.process_input(input_text)
254
+ if output:
255
+ print(output)
256
+ if system_message:
257
+ print(system_message)
258
  except EOFError:
259
  print("Error: Input reading interrupted. Please provide valid input.")
260
+ except KeyboardInterrupt:
261
+ print("\nApplication stopped by user.")
262
+ break
263
+ except Exception as e:
264
+ print(f"An error occurred: {str(e)}")
 
 
 
 
265
 
266
  def main():
267
+ try:
268
+ app = App()
269
+ print(f"===== Application Startup at {datetime.now().strftime('%Y-%m-%d %H:%M:%S')} =====")
270
+ app.run()
271
+ except Exception as e:
272
+ print(f"Failed to initialize the application: {str(e)}")
273
+
274
+ if __name__ == "__main__":
275
+ main()