NCTCMumbai commited on
Commit
8511da7
1 Parent(s): e62fecd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -100,12 +100,14 @@ def bot(history, api_kind):
100
  else:
101
  gr.Warning(f"API {api_kind} is not supported")
102
  raise ValueError(f"API {api_kind} is not supported")
103
-
104
- history[-1][1] = ""
105
- for character in generate_fn(prompt, history[:-1]):
106
- history[-1][1] = character
107
- yield history, prompt_html
108
-
 
 
109
 
110
  with gr.Blocks() as demo:
111
  # Beautiful heading with logo
 
100
  else:
101
  gr.Warning(f"API {api_kind} is not supported")
102
  raise ValueError(f"API {api_kind} is not supported")
103
+ try:
104
+ print(prompt_html)
105
+ history[-1][1] = ""
106
+ for character in generate_fn(prompt, history[:-1]):
107
+ history[-1][1] = character
108
+ yield history, prompt_html
109
+ except Exception as e: # Catch any exception
110
+ yield f"An unexpected error occurred during generation: {str(e)}"
111
 
112
  with gr.Blocks() as demo:
113
  # Beautiful heading with logo