Cyantist8208 commited on
Commit
55a8a56
·
1 Parent(s): eeca4c9

clear cache after answer

Browse files
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -163,6 +163,8 @@ def answer(question: str, user_id="demo"):
163
  return reply
164
  except Exception as e:
165
  return f"Error in app.py: {e}"
 
 
166
 
167
  # ---- UI layout (feel free to tweak cosmetics) -----------------------------
168
  with gr.Blocks() as demo:
 
163
  return reply
164
  except Exception as e:
165
  return f"Error in app.py: {e}"
166
+ finally:
167
+ torch.cuda.empty_cache()
168
 
169
  # ---- UI layout (feel free to tweak cosmetics) -----------------------------
170
  with gr.Blocks() as demo: