Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,11 +3,11 @@ from epub2txt import epub2txt
|
|
| 3 |
|
| 4 |
class GUI:
|
| 5 |
def __init__(self, *args, **kwargs):
|
| 6 |
-
with gr.Blocks(
|
| 7 |
with gr.Row():
|
| 8 |
-
gr.
|
| 9 |
-
gr.
|
| 10 |
-
|
| 11 |
inp = gr.File(file_types=['.epub'])
|
| 12 |
inp.change(self.process, inp, self.out)
|
| 13 |
demo.launch()
|
|
@@ -16,7 +16,9 @@ class GUI:
|
|
| 16 |
ch_list = epub2txt(file, outputlist=True)
|
| 17 |
chapter_titles = epub2txt.content_titles
|
| 18 |
title = epub2txt.title
|
| 19 |
-
return
|
|
|
|
|
|
|
| 20 |
|
| 21 |
def greet(self, name):
|
| 22 |
return "Hello " + name + "!!"
|
|
|
|
| 3 |
|
| 4 |
class GUI:
|
| 5 |
def __init__(self, *args, **kwargs):
|
| 6 |
+
with gr.Blocks() as demo:
|
| 7 |
with gr.Row():
|
| 8 |
+
self.out = gr.Markdown(scale=2).attach_load_event(self.hello, None)
|
| 9 |
+
gr.LoginButton()
|
| 10 |
+
gr.LogoutButton()
|
| 11 |
inp = gr.File(file_types=['.epub'])
|
| 12 |
inp.change(self.process, inp, self.out)
|
| 13 |
demo.launch()
|
|
|
|
| 16 |
ch_list = epub2txt(file, outputlist=True)
|
| 17 |
chapter_titles = epub2txt.content_titles
|
| 18 |
title = epub2txt.title
|
| 19 |
+
return gr.Update(
|
| 20 |
+
f"# {title}\n\n" + "\n\n".join(
|
| 21 |
+
[f"## {ct}\n\n{c}" for ct, c in zip(chapter_titles, ch_list)]))
|
| 22 |
|
| 23 |
def greet(self, name):
|
| 24 |
return "Hello " + name + "!!"
|