Spaces:
Runtime error
Runtime error
Corey Morris
commited on
Commit
·
66e2e92
1
Parent(s):
93fe92a
Avoid reprocessing data
Browse files
app.py
CHANGED
|
@@ -7,7 +7,12 @@ import json
|
|
| 7 |
|
| 8 |
class MultiURLData:
|
| 9 |
def __init__(self):
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
def process_data(self):
|
| 13 |
|
|
@@ -62,8 +67,8 @@ with block:
|
|
| 62 |
data = gr.outputs.Dataframe(type="pandas")
|
| 63 |
with gr.Row():
|
| 64 |
data_run = gr.Button("Refresh")
|
| 65 |
-
data_run.click(data_provider.
|
| 66 |
# running the function on page load in addition to when the button is clicked
|
| 67 |
-
block.load(data_provider.
|
| 68 |
|
| 69 |
block.launch()
|
|
|
|
| 7 |
|
| 8 |
class MultiURLData:
|
| 9 |
def __init__(self):
|
| 10 |
+
self.data = self.process_data()
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
def get_data(self):
|
| 14 |
+
return self.data
|
| 15 |
+
|
| 16 |
|
| 17 |
def process_data(self):
|
| 18 |
|
|
|
|
| 67 |
data = gr.outputs.Dataframe(type="pandas")
|
| 68 |
with gr.Row():
|
| 69 |
data_run = gr.Button("Refresh")
|
| 70 |
+
data_run.click(data_provider.get_data, inputs=None, outputs=data)
|
| 71 |
# running the function on page load in addition to when the button is clicked
|
| 72 |
+
block.load(data_provider.get_data, inputs=None, outputs=data)
|
| 73 |
|
| 74 |
block.launch()
|