NCTCMumbai commited on
Commit
5a2a5a3
·
verified ·
1 Parent(s): 0bbafa3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -93,10 +93,10 @@ env = Environment(loader=FileSystemLoader(proj_dir / 'templates'))
93
  template = env.get_template('template.j2')
94
  template_html = env.get_template('template_html.j2')
95
 
96
- def add_text(history, text):
97
- history = [] if history is None else history
98
- history = history + [(text, None)]
99
- return history, gr.Textbox(value="", interactive=False)
100
 
101
  def bot(history, cross_encoder):
102
 
@@ -157,7 +157,7 @@ def bot(history, cross_encoder):
157
  new_history = history[:-1] + [ (query, "") ]
158
  for character in generate_fn(prompt, history[:-1]):
159
  new_history[-1] = (query, character)
160
- print('Character',character)# Update the last tuple with new text
161
  yield new_history, prompt_html
162
  # history[-1][1] = ""
163
  # for character in generate_fn(prompt, history[:-1]):
@@ -246,6 +246,7 @@ with gr.Blocks(theme='gradio/soft') as CHATBOT:
246
 
247
  translated_textbox = gr.Textbox(label="Translated Response")
248
  def update_history_and_translate(txt, cross_encoder, history_state, language_dropdown):
 
249
  history = history_state
250
  history.append((txt, ""))
251
  #history_state.value=(history)
 
93
  template = env.get_template('template.j2')
94
  template_html = env.get_template('template_html.j2')
95
 
96
+ # def add_text(history, text):
97
+ # history = [] if history is None else history
98
+ # history = history + [(text, None)]
99
+ # return history, gr.Textbox(value="", interactive=False)
100
 
101
  def bot(history, cross_encoder):
102
 
 
157
  new_history = history[:-1] + [ (query, "") ]
158
  for character in generate_fn(prompt, history[:-1]):
159
  new_history[-1] = (query, character)
160
+ #print('Character',character)# Update the last tuple with new text
161
  yield new_history, prompt_html
162
  # history[-1][1] = ""
163
  # for character in generate_fn(prompt, history[:-1]):
 
246
 
247
  translated_textbox = gr.Textbox(label="Translated Response")
248
  def update_history_and_translate(txt, cross_encoder, history_state, language_dropdown):
249
+ print('History state',history_state)
250
  history = history_state
251
  history.append((txt, ""))
252
  #history_state.value=(history)