CognitiveScience commited on
Commit
81ab720
·
1 Parent(s): cb140ef

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -86,7 +86,11 @@ def ccogsphere(name: str, rate: int, celsci: str):
86
  db.close()
87
  r = requests.post(url='https://ccml-persistent-data2.hf.space/api/predict/', json={"data": [name,celsci]})
88
  #demo.load()
89
- return reviews, total_reviews
 
 
 
 
90
 
91
  def ccogsphere2(celsci: str):
92
  result=run_ecs(celscie)
@@ -152,6 +156,7 @@ css="footer {visibility: hidden}"
152
  with gr.Blocks() as demo:
153
  with gr.Row():
154
  with gr.Column():
 
155
  data = gr.Dataframe() #styler)
156
  count = gr.Number(label="Rates!")
157
  with gr.Row():
@@ -161,7 +166,7 @@ with gr.Blocks() as demo:
161
  celsci = gr.Textbox(label="c") #, lines=10, placeholder="Do you have any feedback on gradio?")
162
  #run_actr()
163
  submit = gr.Button(value=".")
164
- submit.click(ccogsphere, [name, rate, celsci], [data, count])
165
  demo.load(load_data, None, [data, count])
166
  @name.change(inputs=name, outputs=celsci,_js="window.location.reload()")
167
  @rate.change(inputs=rate, outputs=name,_js="window.location.reload()")
@@ -174,7 +179,7 @@ with gr.Blocks() as demo:
174
  #return "Hello " + name + "!"
175
  with gr.Row():
176
  with gr.Column():
177
- data2 = gr.Dataframe() #styler)
178
  count2 = gr.Number(label="Rates2!",value=13)
179
  with gr.Row():
180
  with gr.Column():
@@ -188,7 +193,7 @@ with gr.Blocks() as demo:
188
  celsci2 = gr.Textbox(label="c2") #, lines=10, placeholder="Do you have any feedback on gradio?")
189
  #run_actr()
190
  submit2 = gr.Button(value="E")
191
- submit2.click(run_ecs, [celsci2], [data2])
192
  #demo.load(load_data2, None, [data2])
193
  def backup_db():
194
  shutil.copyfile(DB_FILE, "./reviews1E.db")
 
86
  db.close()
87
  r = requests.post(url='https://ccml-persistent-data2.hf.space/api/predict/', json={"data": [name,celsci]})
88
  #demo.load()
89
+ inp=celsci.split(" ")
90
+ inp=inp[0] + "+" + inp[1]
91
+ result=ecf(inp)
92
+ df=pd.DataFrame.from_dict(result["videos"])
93
+ return df,reviews, total_reviews
94
 
95
  def ccogsphere2(celsci: str):
96
  result=run_ecs(celscie)
 
156
  with gr.Blocks() as demo:
157
  with gr.Row():
158
  with gr.Column():
159
+ data2 = gr.Dataframe() #styler)
160
  data = gr.Dataframe() #styler)
161
  count = gr.Number(label="Rates!")
162
  with gr.Row():
 
166
  celsci = gr.Textbox(label="c") #, lines=10, placeholder="Do you have any feedback on gradio?")
167
  #run_actr()
168
  submit = gr.Button(value=".")
169
+ submit.click(ccogsphere, [name, rate, celsci], [data2, data, count])
170
  demo.load(load_data, None, [data, count])
171
  @name.change(inputs=name, outputs=celsci,_js="window.location.reload()")
172
  @rate.change(inputs=rate, outputs=name,_js="window.location.reload()")
 
179
  #return "Hello " + name + "!"
180
  with gr.Row():
181
  with gr.Column():
182
+ data3 = gr.Dataframe() #styler)
183
  count2 = gr.Number(label="Rates2!",value=13)
184
  with gr.Row():
185
  with gr.Column():
 
193
  celsci2 = gr.Textbox(label="c2") #, lines=10, placeholder="Do you have any feedback on gradio?")
194
  #run_actr()
195
  submit2 = gr.Button(value="E")
196
+ submit2.click(run_ecs, [celsci2], [data3])
197
  #demo.load(load_data2, None, [data2])
198
  def backup_db():
199
  shutil.copyfile(DB_FILE, "./reviews1E.db")