acecalisto3 commited on
Commit
3104a5d
1 Parent(s): 42f5aa9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -40,11 +40,11 @@ def get_example_values():
40
  with open(EXAMPLES_PATH, 'r', encoding='utf-8') as f:
41
  return json.load(f)
42
  except Exception as e:
43
- print(f"Error loading examples: {e}")
44
  return []
45
 
46
  def get_chatbot():
47
- return gr.Chatbot(elem_id="chatbot")
48
 
49
  def get_yes_btn():
50
  return gr.Button("Yes", variant="primary", interactive=False)
@@ -55,8 +55,8 @@ def get_consecutive_yes():
55
  def get_custom_response():
56
  return gr.Textbox(label="Custom Response", placeholder="Press 'Enter' to Submit.", interactive=False)
57
 
58
- def get_progress_bar():
59
- return gr.ProgressBar(label="Progress")
60
 
61
  def get_generated_files():
62
  return gr.HTML(lambda: f"Generated Files<pre><code style='overflow-x: auto'>{utils.format_directory(OUTPUT_DIR)}</pre></code>", every=3, elem_id="files")
@@ -89,7 +89,7 @@ def send_message(count, chat, api, message="Y"):
89
  for i in range(count):
90
  chat.append([message, None])
91
  yield chat, count - i
92
- api.send_message(message)
93
  for updated_chat in bot_response(chat, api):
94
  yield updated_chat, count - i
95
 
@@ -141,7 +141,7 @@ with gr.Blocks(css=CSS) as app:
141
  yes_btn = get_yes_btn()
142
  consecutive_yes = get_consecutive_yes()
143
  custom_response = get_custom_response()
144
- progress_bar = get_progress_bar()
145
  with gr.Column(scale=1):
146
  generated_files = get_generated_files()
147
  download_btn = get_download_btn()
 
40
  with open(EXAMPLES_PATH, 'r', encoding='utf-8') as f:
41
  return json.load(f)
42
  except Exception as e:
43
+ logger.error(f"Error loading examples: {e}")
44
  return []
45
 
46
  def get_chatbot():
47
+ return gr.Chatbot(elem_id="chatbot", type='messages') # Specify type as 'messages'
48
 
49
  def get_yes_btn():
50
  return gr.Button("Yes", variant="primary", interactive=False)
 
55
  def get_custom_response():
56
  return gr.Textbox(label="Custom Response", placeholder="Press 'Enter' to Submit.", interactive=False)
57
 
58
+ def get_progress():
59
+ return gr.Progress(label="Progress") # Use gr.Progress instead of gr.ProgressBar
60
 
61
  def get_generated_files():
62
  return gr.HTML(lambda: f"Generated Files<pre><code style='overflow-x: auto'>{utils.format_directory(OUTPUT_DIR)}</pre></code>", every=3, elem_id="files")
 
89
  for i in range(count):
90
  chat.append([message, None])
91
  yield chat, count - i
92
+ api.send_message (message)
93
  for updated_chat in bot_response(chat, api):
94
  yield updated_chat, count - i
95
 
 
141
  yes_btn = get_yes_btn()
142
  consecutive_yes = get_consecutive_yes()
143
  custom_response = get_custom_response()
144
+ progress = get_progress() # Use the corrected progress function
145
  with gr.Column(scale=1):
146
  generated_files = get_generated_files()
147
  download_btn = get_download_btn()