Spaces:
Runtime error
Runtime error
import gradio as gr | |
class GUI: | |
def __init__(self): | |
with gr.Blocks() as demo: | |
with gr.Row(): | |
gr.LoginButton() | |
self.l_o_btn = gr.LogoutButton(visible=False) | |
self.inp = gr.File(file_types=['.epub'], visible=False) | |
self.out = gr.Markdown().attach_load_event(self.hello, None) | |
self.inp.change(self.hello, self.inp, self.out) | |
demo.launch() | |
def greet(self, name): | |
return "Hello " + name + "!!" | |
def hello(self, profile: gr.OAuthProfile | None): | |
if profile is None: | |
return ( | |
'# ePub summarization tool ' | |
'<p style="text-align: center;">Login to access the tool.</p>' | |
) | |
self.l_o_btn.update(visible=True) | |
self.inp.update(visible=True) | |
return self.greet(profile.name) | |
GUI() |