broadfield-dev commited on
Commit
4220939
·
verified ·
1 Parent(s): 9bc382d

Create templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +68 -0
templates/index.html ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
6
+ <title>PDF to Markdown Converter (Flask)</title>
7
+ <style>
8
+ body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; margin: 0; background-color: #f0f2f5; color: #1c1e21; line-height: 1.5; }
9
+ .navbar { background-color: #1877f2; padding: 10px 20px; color: white; text-align: center; }
10
+ .navbar h1 { margin: 0; font-size: 1.8em; }
11
+ .container { max-width: 800px; margin: 20px auto; background-color: #fff; padding: 25px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1), 0 8px 16px rgba(0,0,0,0.1); }
12
+ p { margin-bottom: 1em; }
13
+ label { display: block; margin-top: 15px; margin-bottom: 5px; font-weight: 600; color: #4b4f56; }
14
+ input[type="file"], input[type="text"] { width: calc(100% - 22px); padding: 10px; margin-top: 5px; border: 1px solid #dddfe2; border-radius: 6px; font-size: 1em; }
15
+ input[type="file"] { padding: 7px; }
16
+ input[type="submit"] { background-color: #1877f2; color: white; padding: 10px 20px; border: none; border-radius: 6px; cursor: pointer; margin-top: 25px; font-size: 1.1em; font-weight: bold; }
17
+ input[type="submit"]:hover { background-color: #166fe5; }
18
+ .message { margin-top: 20px; padding: 12px; border-radius: 6px; font-size: 0.95em; }
19
+ .status { background-color: #e7f3ff; border: 1px solid #cfe2ff; color: #055160; }
20
+ .error { background-color: #f8d7da; border: 1px solid #f5c2c7; color: #842029; }
21
+ pre { background-color: #f5f6f7; padding: 15px; border: 1px solid #e0e0e0; border-radius: 6px; white-space: pre-wrap; word-wrap: break-word; margin-top: 20px; font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 0.9em; line-height: 1.6; }
22
+ .or-separator { text-align: center; margin: 20px 0; font-weight: bold; color: #606770; }
23
+ .form-actions { text-align: center; }
24
+ .footer { text-align: center; margin-top: 30px; font-size: 0.85em; color: #606770; }
25
+ </style>
26
+ </head>
27
+ <body>
28
+ <div class="navbar">
29
+ <h1>PDF to Markdown Converter</h1>
30
+ </div>
31
+ <div class="container">
32
+ <p>Upload a PDF file or provide a URL to convert it to Markdown. Images will be extracted and uploaded to a Hugging Face dataset (requires <code>HF_TOKEN</code> in Space secrets).</p>
33
+
34
+ {% if error_message %}
35
+ <div class="message error">{{ error_message }}</div>
36
+ {% endif %}
37
+ {% if status_message and not markdown_output %}
38
+ <div class="message status">{{ status_message }}</div>
39
+ {% endif %}
40
+
41
+ <form method="POST" enctype="multipart/form-data" action="{{ url_for('process_pdf_route') }}">
42
+ <div>
43
+ <label for="pdf_file">Upload PDF File:</label>
44
+ <input type="file" name="pdf_file" id="pdf_file" accept=".pdf">
45
+ </div>
46
+ <div class="or-separator">OR</div>
47
+ <div>
48
+ <label for="pdf_url">Enter PDF URL:</label>
49
+ <input type="text" name="pdf_url" id="pdf_url" placeholder="e.g., https://arxiv.org/pdf/1706.03762.pdf">
50
+ </div>
51
+ <div class="form-actions">
52
+ <input type="submit" value="Convert to Markdown">
53
+ </div>
54
+ </form>
55
+
56
+ {% if markdown_output %}
57
+ <h2>Markdown Output:</h2>
58
+ {% if status_message %}
59
+ <div class="message status">{{ status_message }}</div>
60
+ {% endif %}
61
+ <pre>{{ markdown_output }}</pre>
62
+ {% endif %}
63
+ </div>
64
+ <div class="footer">
65
+ <p>Powered by Flask, Poppler, Tesseract, and Hugging Face.</p>
66
+ </div>
67
+ </body>
68
+ </html>