Kate Forsberg commited on
Commit
8adab59
·
1 Parent(s): a47fd15

removing after done?

Browse files
Files changed (1) hide show
  1. app.py +5 -14
app.py CHANGED
@@ -19,13 +19,6 @@ import os
19
  #Load environment variables
20
  load_dotenv()
21
 
22
- #Create Custom styling
23
- custom_css = """
24
- #component-2 {
25
- height: 90vh !important;
26
- min-height: 90vh !important;
27
- }
28
- """
29
 
30
  #Create an agent that will create a prompt that can be used as input for the query agent from the Griptape Cloud.
31
 
@@ -168,6 +161,11 @@ def send_message(message:str, history, request:gr.Request) -> Any:
168
  session_hash = request.session_hash
169
  agent = build_agent(session_hash,message)
170
  response = agent.run(message)
 
 
 
 
 
171
  return response.output.value
172
 
173
  demo = gr.ChatInterface(
@@ -175,10 +173,3 @@ demo = gr.ChatInterface(
175
  )
176
  demo.launch()
177
 
178
- json_files = glob.glob("*.json")
179
- for f in json_files:
180
- try:
181
- os.remove(f)
182
- except OSError as e:
183
- continue
184
-
 
19
  #Load environment variables
20
  load_dotenv()
21
 
 
 
 
 
 
 
 
22
 
23
  #Create an agent that will create a prompt that can be used as input for the query agent from the Griptape Cloud.
24
 
 
161
  session_hash = request.session_hash
162
  agent = build_agent(session_hash,message)
163
  response = agent.run(message)
164
+ if "done" in message.lower():
165
+ try:
166
+ os.remove(f'{session_hash}.json')
167
+ except OSError as e:
168
+ pass
169
  return response.output.value
170
 
171
  demo = gr.ChatInterface(
 
173
  )
174
  demo.launch()
175