npc0 commited on
Commit
ffab851
1 Parent(s): 2c3f6d8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -19
app.py CHANGED
@@ -1,23 +1,27 @@
1
  import gradio as gr
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
 
 
 
 
 
 
 
 
 
5
 
 
 
6
 
7
- def hello(profile: gr.OAuthProfile | None):
8
- if profile is None:
9
- return gr.Markdown(
10
- '# ePub summarization tool '
11
- '<p style="text-align: center;">Login to access the tool.</p>'
12
- )
13
- return f"Hello {profile.name}"
14
-
15
-
16
- with gr.Blocks() as demo:
17
- with gr.Row():
18
- gr.LoginButton()
19
- gr.LogoutButton()
20
- gr.File()
21
- gr.Markdown().attach_load_event(hello, None)
22
-
23
- demo.launch()
 
1
  import gradio as gr
2
 
3
+ class GUI:
4
+ def __init__(self, params):
5
+ with gr.Blocks() as demo:
6
+ with gr.Row():
7
+ gr.LoginButton()
8
+ self.l_o_btn = gr.LogoutButton(visible=False)
9
+ self.inp = gr.File(file_types=['.epub'], visible=False)
10
+ self.out = gr.Markdown().attach_load_event(self.hello, None)
11
+ inp.change(self.hello, self.inp, self.out)
12
+
13
+ demo.launch()
14
 
15
+ def greet(self, name):
16
+ return "Hello " + name + "!!"
17
 
18
+ def hello(self, profile: gr.OAuthProfile | None):
19
+ if profile is None:
20
+ return (
21
+ '# ePub summarization tool '
22
+ '<p style="text-align: center;">Login to access the tool.</p>'
23
+ )
24
+ self.l_o_btn.update(visible=True)
25
+ self.inp.update(visible=True)
26
+ return self.greet(profile.name)
27
+