changes
Browse files
app.py
CHANGED
|
@@ -1,27 +1,3 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
-
from huggingface_hub import InferenceClient
|
| 3 |
-
|
| 4 |
-
"""
|
| 5 |
-
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
| 6 |
-
"""
|
| 7 |
-
<<<<<<< HEAD
|
| 8 |
-
chatbot = gr.ChatInterface(
|
| 9 |
-
respond,
|
| 10 |
-
type="messages",
|
| 11 |
-
additional_inputs=[
|
| 12 |
-
gr.Textbox(value="You are Harry Potter.", label="System message"),
|
| 13 |
-
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
| 14 |
-
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
| 15 |
-
gr.Slider(
|
| 16 |
-
minimum=0.1,
|
| 17 |
-
maximum=1.0,
|
| 18 |
-
value=0.95,
|
| 19 |
-
step=0.05,
|
| 20 |
-
label="Top-p (nucleus sampling)",
|
| 21 |
-
),
|
| 22 |
-
],
|
| 23 |
-
=======
|
| 24 |
-
|
| 25 |
import gradio as gr
|
| 26 |
from gradio_pdf import PDF
|
| 27 |
from pdf2image import convert_from_path
|
|
@@ -33,7 +9,6 @@ dir_ = Path(__file__).parent
|
|
| 33 |
p = pipeline(
|
| 34 |
"document-question-answering",
|
| 35 |
model="impira/layoutlm-document-qa",
|
| 36 |
-
>>>>>>> 4359e45b8375a96ce5a5b5d1eac342824df4364d
|
| 37 |
)
|
| 38 |
|
| 39 |
def qa(question: str, doc: str) -> str:
|
|
@@ -51,4 +26,4 @@ demo = gr.Interface(
|
|
| 51 |
)
|
| 52 |
|
| 53 |
if __name__ == "__main__":
|
| 54 |
-
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from gradio_pdf import PDF
|
| 3 |
from pdf2image import convert_from_path
|
|
|
|
| 9 |
p = pipeline(
|
| 10 |
"document-question-answering",
|
| 11 |
model="impira/layoutlm-document-qa",
|
|
|
|
| 12 |
)
|
| 13 |
|
| 14 |
def qa(question: str, doc: str) -> str:
|
|
|
|
| 26 |
)
|
| 27 |
|
| 28 |
if __name__ == "__main__":
|
| 29 |
+
demo.launch()
|