Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,23 +1,27 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
|
|
|
|
6 |
|
7 |
-
def hello(profile: gr.OAuthProfile | None):
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
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 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|