baxin commited on
Commit
7962d98
1 Parent(s): 8be58cc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -3
app.py CHANGED
@@ -19,13 +19,17 @@ def send_post_request(payload):
19
  return "Error: " + response.text
20
 
21
  # Check the response before returning it
 
22
  response_data = response.json()
23
  if "error_message" in response_data:
24
  print("Error in response:", response_data["error_message"])
25
  return response_data["error_message"]
26
  elif "protocol_name" in response_data:
27
- print("Protocol executed successfully. Run log:", response_data["run_log"])
28
- return response_data["run_log"]
 
 
 
29
  else:
30
  print("Unexpected response:", response_data)
31
  return "Unexpected response"
@@ -37,8 +41,15 @@ def send_message(text, chatbot):
37
  chatbot.append(("opentrons_simulator result", response))
38
  return chatbot
39
 
 
 
 
 
 
 
40
  with gr.Blocks() as app:
41
- textbox = gr.Textbox()
 
42
  send_button = gr.Button(value="Send")
43
  chatbot = gr.Chatbot()
44
  clear_button = gr.ClearButton([textbox, chatbot])
 
19
  return "Error: " + response.text
20
 
21
  # Check the response before returning it
22
+ # ToDo clean up code
23
  response_data = response.json()
24
  if "error_message" in response_data:
25
  print("Error in response:", response_data["error_message"])
26
  return response_data["error_message"]
27
  elif "protocol_name" in response_data:
28
+ # print("Protocol executed successfully. Run log:", response_data["run_log"])
29
+
30
+ return response_data["run_status"]
31
+ # ToDo if run_log option is on
32
+ # return response_data["run_log"]
33
  else:
34
  print("Unexpected response:", response_data)
35
  return "Unexpected response"
 
41
  chatbot.append(("opentrons_simulator result", response))
42
  return chatbot
43
 
44
+ title = """
45
+ <div align="center">
46
+ # OT-2 Simulator: Emulating Opentrons Protocols with Python API
47
+
48
+ </div>
49
+ """
50
  with gr.Blocks() as app:
51
+ gr.Markdown(title)
52
+ textbox = gr.Textbox(label="Enter protocol")
53
  send_button = gr.Button(value="Send")
54
  chatbot = gr.Chatbot()
55
  clear_button = gr.ClearButton([textbox, chatbot])