CognitiveScience commited on
Commit
d2281a3
1 Parent(s): c71ea91

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -4
app.py CHANGED
@@ -24,7 +24,6 @@ tim = MyAgent()
24
  subway=MyEnv()
25
  subway.agent=tim
26
  log_everything(subway)
27
- subway.run()
28
 
29
  DB_FILE = "./reviews1.db"
30
 
@@ -79,9 +78,17 @@ def load_data():
79
  reviews, total_reviews = get_latest_reviews(db)
80
  db.close()
81
  return reviews, total_reviews
 
 
 
 
 
 
 
 
82
  css="footer {visibility: hidden}"
83
 
84
- with gr.Blocks(css=css,api_name=["/ccogsphere"]) as demo:
85
  with gr.Row():
86
  with gr.Column():
87
  #with gr.Box():
@@ -94,7 +101,6 @@ with gr.Blocks(css=css,api_name=["/ccogsphere"]) as demo:
94
  rate = gr.Textbox(label="b") #, placeholder="What is your name?") #gr.Radio(label="How satisfied are you with using gradio?", choices=[1, 2, 3, 4, 5])
95
  celsci = gr.Textbox(label="c") #, lines=10, placeholder="Do you have any feedback on gradio?")
96
  submit = gr.Button(value=".")
97
-
98
 
99
  submit.click(ccogsphere, [name, rate, celsci], [data, count])
100
  demo.load(load_data, None, [data, count])
@@ -104,7 +110,8 @@ with gr.Blocks(css=css,api_name=["/ccogsphere"]) as demo:
104
 
105
  def secwork(name):
106
  #if name=="abc":
107
- load_data()
 
108
  #return "Hello " + name + "!"
109
 
110
  def backup_db():
 
24
  subway=MyEnv()
25
  subway.agent=tim
26
  log_everything(subway)
 
27
 
28
  DB_FILE = "./reviews1.db"
29
 
 
78
  reviews, total_reviews = get_latest_reviews(db)
79
  db.close()
80
  return reviews, total_reviews
81
+ def run_code():
82
+ #code1="tim = MyAgent()"
83
+ #code2="subway=MyEnv()"
84
+ #code3="subway.agent=tim"
85
+ #code4="log_everything(subway)"
86
+ code5="subway.run()"
87
+ exec(code5)
88
+
89
  css="footer {visibility: hidden}"
90
 
91
+ with gr.Blocks(css=css) as demo:
92
  with gr.Row():
93
  with gr.Column():
94
  #with gr.Box():
 
101
  rate = gr.Textbox(label="b") #, placeholder="What is your name?") #gr.Radio(label="How satisfied are you with using gradio?", choices=[1, 2, 3, 4, 5])
102
  celsci = gr.Textbox(label="c") #, lines=10, placeholder="Do you have any feedback on gradio?")
103
  submit = gr.Button(value=".")
 
104
 
105
  submit.click(ccogsphere, [name, rate, celsci], [data, count])
106
  demo.load(load_data, None, [data, count])
 
110
 
111
  def secwork(name):
112
  #if name=="abc":
113
+ run_code()
114
+ #load_data()
115
  #return "Hello " + name + "!"
116
 
117
  def backup_db():