znation's picture
znation HF staff
ssl reecursion fix in app
b9e402d
raw
history blame
694 Bytes
# found on https://stackoverflow.com/a/52130355 to fix infinite recursion with ssl
# at the beginning of the script
import gevent.monkey
gevent.monkey.patch_all()
import sys
import gradio as gr
import list_repos
import refresh_lists
def greet(name):
try:
refresh_repos()
refresh_files()
return "Hello " + name + "!!"
except:
raise gr.Error(str(sys.exc_info()))
def refresh_repos(progress=gr.Progress(track_tqdm=True)):
list_repos.write_repos_to_db()
def refresh_files(progress=gr.Progress(track_tqdm=True)):
while True:
refresh_lists.refresh_oldest_repo()
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
demo.launch()