Andrei Shadrikov
commited on
Commit
·
79a48cc
1
Parent(s):
1de13f7
themes
Browse files
app.py
CHANGED
@@ -76,38 +76,38 @@ def interact_with_pdf(doc, question):
|
|
76 |
|
77 |
|
78 |
with gr.Blocks(theme=gr.themes.Default(primary_hue=gr.themes.colors.red, secondary_hue=gr.themes.colors.pink)) as demo:
|
79 |
-
text_interface =
|
80 |
fn=extract_text,
|
81 |
-
inputs=PDF(label="
|
82 |
-
outputs=
|
83 |
-
title="PDF
|
84 |
-
description="
|
85 |
)
|
86 |
|
87 |
-
pdf_interface =
|
88 |
fn=process_pdf,
|
89 |
-
inputs=[PDF(label="
|
90 |
-
outputs=[
|
91 |
-
title="PDF
|
92 |
-
description="
|
93 |
)
|
94 |
|
95 |
-
image_interface =
|
96 |
fn=interact_with_pdf,
|
97 |
inputs=[
|
98 |
-
PDF(label="
|
99 |
-
|
100 |
],
|
101 |
-
outputs=
|
102 |
-
title="
|
103 |
-
description="
|
104 |
)
|
105 |
|
106 |
# Create a tabbed interface
|
107 |
-
tabbed_interface =
|
108 |
[text_interface, pdf_interface, image_interface],
|
109 |
-
title="PDF
|
110 |
-
tab_names=["
|
111 |
# description="Choose a tab to perform the desired task."
|
112 |
)
|
113 |
|
|
|
76 |
|
77 |
|
78 |
with gr.Blocks(theme=gr.themes.Default(primary_hue=gr.themes.colors.red, secondary_hue=gr.themes.colors.pink)) as demo:
|
79 |
+
text_interface = demo.Interface(
|
80 |
fn=extract_text,
|
81 |
+
inputs=PDF(label="Загрузить PDF"),
|
82 |
+
outputs=demo.Textbox(label="Полученный текст"),
|
83 |
+
title="PDF в текст",
|
84 |
+
description="Сервис вынимает содержащийся в PDF контейнере текст."
|
85 |
)
|
86 |
|
87 |
+
pdf_interface = demo.Interface(
|
88 |
fn=process_pdf,
|
89 |
+
inputs=[PDF(label="Загрузить PDF"), out_files],
|
90 |
+
outputs=[demo.File(label="Скачать ZIP архив"), out_files],
|
91 |
+
title="PDF в картинки",
|
92 |
+
description="Переводит постранично файл в изображения, и предлагает бскачать в виде ZIP архива."
|
93 |
)
|
94 |
|
95 |
+
image_interface = demo.Interface(
|
96 |
fn=interact_with_pdf,
|
97 |
inputs=[
|
98 |
+
PDF(label="Загрузить PDF"),
|
99 |
+
demo.Textbox(label="Что хотите найти?")
|
100 |
],
|
101 |
+
outputs=demo.Textbox(label="Возможный ответ"),
|
102 |
+
title="Спроси PDF",
|
103 |
+
description="Сервис через методы OCR сканирует загруженный файл для нахождения ответа на заданный вопрос."
|
104 |
)
|
105 |
|
106 |
# Create a tabbed interface
|
107 |
+
tabbed_interface = demo.TabbedInterface(
|
108 |
[text_interface, pdf_interface, image_interface],
|
109 |
+
title="Взаимодействие с PDF",
|
110 |
+
tab_names=["В текст", "В картинки", "Задай вопрос"],
|
111 |
# description="Choose a tab to perform the desired task."
|
112 |
)
|
113 |
|