CognitiveScience commited on
Commit
7ef424f
1 Parent(s): 20b6e5e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -6
app.py CHANGED
@@ -103,10 +103,16 @@ css="footer {visibility: hidden}"
103
  with gr.Blocks(css=css) as demo:
104
  with gr.Row():
105
  with gr.Column():
106
- #with gr.Box():
107
- #gr.Markdown("Based on dataset [here](https://huggingface.co/datasets/freddyaboulton/gradio-reviews)")
108
  data = gr.Dataframe()
109
  count = gr.Number(label="Rates!")
 
 
 
 
 
 
 
 
110
  with gr.Row():
111
  with gr.Column():
112
  name = gr.Textbox(label="a") #, placeholder="What is your name?")
@@ -118,7 +124,13 @@ with gr.Blocks(css=css) as demo:
118
  demo.load(load_data, None, [data, count])
119
  @name.change(inputs=name, outputs=celsci,_js="window.location.reload()")
120
  @rate.change(inputs=rate, outputs=name,_js="window.location.reload()")
121
- @celsci.change(inputs=celsci, outputs=rate,_js="window.location.reload()")
 
 
 
 
 
 
122
  def backup_db():
123
  shutil.copyfile(DB_FILE, "./reviews.2db")
124
  db = sqlite3.connect(DB_FILE)
@@ -134,9 +146,9 @@ def load_data2():
134
  demo.load(load_data,None, [reviews, total_reviews])
135
  #return reviews, total_reviews
136
 
137
- scheduler = BackgroundScheduler()
138
- scheduler.add_job(func=run_actr, trigger="interval", seconds=10)
139
- scheduler.start()
140
 
141
  #scheduler2 = BackgroundScheduler()
142
  #scheduler2.add_job(func=load_data2, trigger="interval", seconds=10)
 
103
  with gr.Blocks(css=css) as demo:
104
  with gr.Row():
105
  with gr.Column():
 
 
106
  data = gr.Dataframe()
107
  count = gr.Number(label="Rates!")
108
+ def refre():
109
+ demo.load(load_data, None, [data, count])
110
+
111
+ scheduler = BackgroundScheduler()
112
+ scheduler.add_job(func=refre, trigger="interval", seconds=10)
113
+ scheduler.start()
114
+ #with gr.Box():
115
+ #gr.Markdown("Based on dataset [here](https://huggingface.co/datasets/freddyaboulton/gradio-reviews)")
116
  with gr.Row():
117
  with gr.Column():
118
  name = gr.Textbox(label="a") #, placeholder="What is your name?")
 
124
  demo.load(load_data, None, [data, count])
125
  @name.change(inputs=name, outputs=celsci,_js="window.location.reload()")
126
  @rate.change(inputs=rate, outputs=name,_js="window.location.reload()")
127
+ @celsci.change(inputs=celsci, outputs=rate,_js="window.location.reload()")
128
+
129
+ def secwork(name):
130
+ #if name=="abc":
131
+ #run_code()
132
+ load_data()
133
+ #return "Hello " + name + "!"
134
  def backup_db():
135
  shutil.copyfile(DB_FILE, "./reviews.2db")
136
  db = sqlite3.connect(DB_FILE)
 
146
  demo.load(load_data,None, [reviews, total_reviews])
147
  #return reviews, total_reviews
148
 
149
+ scheduler2 = BackgroundScheduler()
150
+ scheduler2.add_job(func=run_actr, trigger="interval", seconds=10)
151
+ scheduler2.start()
152
 
153
  #scheduler2 = BackgroundScheduler()
154
  #scheduler2.add_job(func=load_data2, trigger="interval", seconds=10)