Spaces:
Runtime error
Runtime error
Fix restart
Browse files
app.py
CHANGED
@@ -8,6 +8,7 @@ import altair as alt
|
|
8 |
import argilla as rg
|
9 |
from argilla.feedback import FeedbackDataset
|
10 |
from argilla.client.feedback.dataset.remote.dataset import RemoteFeedbackDataset
|
|
|
11 |
import gradio as gr
|
12 |
import pandas as pd
|
13 |
|
@@ -35,6 +36,20 @@ NUMBER_ANNOTATIONS = 'PoΔet anotacΓ'
|
|
35 |
|
36 |
CATEGORY = 'Kategorie'
|
37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
def obtain_source_target_datasets() -> (
|
39 |
Tuple[
|
40 |
FeedbackDataset | RemoteFeedbackDataset, FeedbackDataset | RemoteFeedbackDataset
|
@@ -287,7 +302,7 @@ def main() -> None:
|
|
287 |
}
|
288 |
"""
|
289 |
|
290 |
-
with gr.Blocks(css=css) as demo:
|
291 |
gr.Markdown(
|
292 |
"""
|
293 |
# π Czech - Multilingual Prompt Evaluation Project
|
@@ -359,7 +374,10 @@ def main() -> None:
|
|
359 |
interactive=False,
|
360 |
)
|
361 |
demo.load(get_top, None, [top_df_plot])
|
362 |
-
|
|
|
|
|
|
|
363 |
# Launch the Gradio interface
|
364 |
demo.launch()
|
365 |
|
|
|
8 |
import argilla as rg
|
9 |
from argilla.feedback import FeedbackDataset
|
10 |
from argilla.client.feedback.dataset.remote.dataset import RemoteFeedbackDataset
|
11 |
+
from huggingface_hub import restart_space
|
12 |
import gradio as gr
|
13 |
import pandas as pd
|
14 |
|
|
|
36 |
|
37 |
CATEGORY = 'Kategorie'
|
38 |
|
39 |
+
def restart() -> None:
|
40 |
+
"""
|
41 |
+
This function restarts the space where the dashboard is hosted.
|
42 |
+
"""
|
43 |
+
|
44 |
+
# Update Space name with your Space information
|
45 |
+
gr.Info("Restarting space at " + str(datetime.datetime.now()))
|
46 |
+
restart_space(
|
47 |
+
"ignacioct/TryingRestartDashboard",
|
48 |
+
token=os.getenv("HF_TOKEN"),
|
49 |
+
# factory_reboot=True,
|
50 |
+
)
|
51 |
+
|
52 |
+
|
53 |
def obtain_source_target_datasets() -> (
|
54 |
Tuple[
|
55 |
FeedbackDataset | RemoteFeedbackDataset, FeedbackDataset | RemoteFeedbackDataset
|
|
|
302 |
}
|
303 |
"""
|
304 |
|
305 |
+
with gr.Blocks(css=css, delete_cache=(300, 300)) as demo:
|
306 |
gr.Markdown(
|
307 |
"""
|
308 |
# π Czech - Multilingual Prompt Evaluation Project
|
|
|
374 |
interactive=False,
|
375 |
)
|
376 |
demo.load(get_top, None, [top_df_plot])
|
377 |
+
# Manage background refresh
|
378 |
+
scheduler = BackgroundScheduler()
|
379 |
+
_ = scheduler.add_job(restart, "interval", minutes=30)
|
380 |
+
scheduler.start()
|
381 |
# Launch the Gradio interface
|
382 |
demo.launch()
|
383 |
|