os1187 commited on
Commit
3146891
·
verified ·
1 Parent(s): ab9f628

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -21,11 +21,12 @@ css = """
21
 
22
  # Define layout with custom styles
23
  layout = [
24
- gr.Row([gr.File(label="Upload PDF", type="file")]),
25
  gr.Row([gr.Button("Generate Insights", type="submit")]),
26
  gr.Row([gr.Textbox("Placeholder for PDF insights", label="Insights", type="text")])
27
  ]
28
 
 
29
  # Function to get image embeddings using ViT
30
  def get_image_embeddings(image_path, model_name='google/vit-base-patch16-224'):
31
  feature_extractor = ViTFeatureExtractor.from_pretrained(model_name)
@@ -84,12 +85,13 @@ def process_pdf_and_generate_response(pdf_file):
84
 
85
  iface = gr.Interface(
86
  fn=process_pdf_and_generate_response,
87
- inputs=gr.File(label="Upload PDF", type="file"),
88
  outputs=gr.Textbox("Placeholder for PDF insights", label="Insights", type="text"),
89
  title="pdf-chatbot",
90
  description="Upload a PDF and receive insights based on its content.",
91
  css=css # Add the CSS styles here
92
  )
93
 
 
94
  if __name__ == "__main__":
95
  iface.launch()
 
21
 
22
  # Define layout with custom styles
23
  layout = [
24
+ gr.Row([gr.File(label="Upload PDF", type="filepath")]), # Changed 'file' to 'filepath'
25
  gr.Row([gr.Button("Generate Insights", type="submit")]),
26
  gr.Row([gr.Textbox("Placeholder for PDF insights", label="Insights", type="text")])
27
  ]
28
 
29
+
30
  # Function to get image embeddings using ViT
31
  def get_image_embeddings(image_path, model_name='google/vit-base-patch16-224'):
32
  feature_extractor = ViTFeatureExtractor.from_pretrained(model_name)
 
85
 
86
  iface = gr.Interface(
87
  fn=process_pdf_and_generate_response,
88
+ inputs=gr.File(label="Upload PDF", type="filepath"), # Changed 'file' to 'filepath'
89
  outputs=gr.Textbox("Placeholder for PDF insights", label="Insights", type="text"),
90
  title="pdf-chatbot",
91
  description="Upload a PDF and receive insights based on its content.",
92
  css=css # Add the CSS styles here
93
  )
94
 
95
+
96
  if __name__ == "__main__":
97
  iface.launch()