acecalisto3 commited on
Commit
2b45640
·
verified ·
1 Parent(s): c1d00ee

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -24
app.py CHANGED
@@ -3,13 +3,9 @@ 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
8
- import gradio as gr
9
-
10
  from safe_search import safe_search
11
  from i_search import google, i_search as i_s
12
-
13
  from agent import (
14
  ACTION_PROMPT,
15
  ADD_PROMPT,
@@ -23,12 +19,11 @@ from agent import (
23
  TASK_PROMPT,
24
  UNDERSTAND_TEST_RESULTS_PROMPT,
25
  )
26
-
27
  from utils import parse_action, parse_file_content, read_python_module_structure
28
 
29
-
30
- class App:
31
  def __init__(self):
 
32
  self.app_state = {"components": []}
33
  self.terminal_history = ""
34
  self.components_registry = {
@@ -226,22 +221,7 @@ def run(self):
226
  print("Welcome to the Python App Builder!")
227
  print("Type 'help' to see the available commands.")
228
  print("-" * 50)
229
- try:
230
- while True:
231
- try:
232
- input_text = input("Enter input: ")
233
- except EOFError:
234
- print("Error: Input reading interrupted. Please provide valid input.")
235
- continue
236
-
237
- output, system_message = self.process_input(input_text)
238
- if output:
239
- print(output)
240
- if system_message:
241
- print(system_message)
242
- except KeyboardInterrupt:
243
- print("\nApplication stopped by user.")
244
-
245
 
246
  if __name__ == "__main__":
247
  app = App()
 
3
  import random
4
  import json
5
  from datetime import datetime
6
+ from gradio import gr, Block
 
 
 
7
  from safe_search import safe_search
8
  from i_search import google, i_search as i_s
 
9
  from agent import (
10
  ACTION_PROMPT,
11
  ADD_PROMPT,
 
19
  TASK_PROMPT,
20
  UNDERSTAND_TEST_RESULTS_PROMPT,
21
  )
 
22
  from utils import parse_action, parse_file_content, read_python_module_structure
23
 
24
+ class App(Block):
 
25
  def __init__(self):
26
+ super().__init__()
27
  self.app_state = {"components": []}
28
  self.terminal_history = ""
29
  self.components_registry = {
 
221
  print("Welcome to the Python App Builder!")
222
  print("Type 'help' to see the available commands.")
223
  print("-" * 50)
224
+ self.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
225
 
226
  if __name__ == "__main__":
227
  app = App()