Spaces:
Running
on
L4
Running
on
L4
added cleaning scheduler
Browse files
app.py
CHANGED
@@ -10,6 +10,7 @@ import huggingface_hub
|
|
10 |
from huggingface_hub import HfApi
|
11 |
from huggingface_hub import ModelCard
|
12 |
|
|
|
13 |
from gradio_huggingfacehub_search import HuggingfaceHubSearch
|
14 |
|
15 |
from textwrap import dedent
|
@@ -205,6 +206,9 @@ def button_click(hf_model_id, conv_template, quantization, oauth_token: gr.OAuth
|
|
205 |
os.system("rm -rf dist/")
|
206 |
return "Successful, please find your compiled LLM model on your personal account"
|
207 |
|
|
|
|
|
|
|
208 |
with gr.Blocks() as demo:
|
209 |
gr.LoginButton()
|
210 |
gr.Markdown(
|
@@ -225,4 +229,8 @@ with gr.Blocks() as demo:
|
|
225 |
click_event = btn.click(fn=button_click , inputs=[model_id, conv, quant], outputs=out)
|
226 |
btn2.click(fn=None, inputs=None, outputs=None, cancels=[click_event], js="window.location.reload()")
|
227 |
|
|
|
|
|
|
|
|
|
228 |
demo.queue(max_size=5).launch()
|
|
|
10 |
from huggingface_hub import HfApi
|
11 |
from huggingface_hub import ModelCard
|
12 |
|
13 |
+
from apscheduler.schedulers.background import BackgroundScheduler
|
14 |
from gradio_huggingfacehub_search import HuggingfaceHubSearch
|
15 |
|
16 |
from textwrap import dedent
|
|
|
206 |
os.system("rm -rf dist/")
|
207 |
return "Successful, please find your compiled LLM model on your personal account"
|
208 |
|
209 |
+
def clean():
|
210 |
+
os.system("rm -rf dist/")
|
211 |
+
|
212 |
with gr.Blocks() as demo:
|
213 |
gr.LoginButton()
|
214 |
gr.Markdown(
|
|
|
229 |
click_event = btn.click(fn=button_click , inputs=[model_id, conv, quant], outputs=out)
|
230 |
btn2.click(fn=None, inputs=None, outputs=None, cancels=[click_event], js="window.location.reload()")
|
231 |
|
232 |
+
scheduler = BackgroundScheduler()
|
233 |
+
scheduler.add_job(clean, "interval", seconds=21600)
|
234 |
+
scheduler.start()
|
235 |
+
|
236 |
demo.queue(max_size=5).launch()
|