witcher23 commited on
Commit
9ebb8d4
·
verified ·
1 Parent(s): 6a60dbd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -2
app.py CHANGED
@@ -3,6 +3,7 @@ from huggingface_hub import InferenceClient
3
  import PyPDF2
4
  import io
5
 
 
6
  """
7
  For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
8
  """
@@ -56,6 +57,14 @@ def extract_text_from_pdf(pdf_file):
56
  return f"An error occurred: {str(e)}"
57
 
58
 
 
 
 
 
 
 
 
 
59
  """
60
  For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
61
  """
@@ -83,9 +92,10 @@ pdf_interface = gr.Interface(
83
  description="Upload a PDF file to extract its text content."
84
  )
85
 
 
86
  demo = gr.TabbedInterface(
87
- [demo, pdf_interface],
88
- ["Chat", "PDF Extractor"]
89
  )
90
 
91
  if __name__ == "__main__":
 
3
  import PyPDF2
4
  import io
5
 
6
+
7
  """
8
  For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
9
  """
 
57
  return f"An error occurred: {str(e)}"
58
 
59
 
60
+ # Update the Chatbot component
61
+ chatbot = gr.Chatbot(
62
+ [],
63
+ elem_id="chatbot",
64
+ avatar_images=(None, (os.path.join(os.path.dirname(__file__), "avatar.png"))),
65
+ bubble_full_width=False,
66
+ )
67
+
68
  """
69
  For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
70
  """
 
92
  description="Upload a PDF file to extract its text content."
93
  )
94
 
95
+ # Create the tabbed interface
96
  demo = gr.TabbedInterface(
97
+ interface_list=[demo, pdf_interface],
98
+ tab_names=["Chat", "PDF Extractor"]
99
  )
100
 
101
  if __name__ == "__main__":