Spaces:
Running
Running
Update index.html
Browse files- index.html +6 -41
index.html
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
|
| 2 |
<html>
|
| 3 |
<head>
|
| 4 |
<meta charset="utf-8" />
|
|
@@ -16,29 +16,12 @@
|
|
| 16 |
</p>
|
| 17 |
</div>
|
| 18 |
</body>
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
<!doctype html>
|
| 23 |
-
<html>
|
| 24 |
-
<head>
|
| 25 |
-
<meta charset="utf-8" />
|
| 26 |
-
<meta name="viewport" content="width=device-width" />
|
| 27 |
-
<title>My static Space</title>
|
| 28 |
-
<link rel="stylesheet" href="style.css" />
|
| 29 |
-
<script>
|
| 30 |
-
async function sendData() {
|
| 31 |
-
// Get the value from the input field
|
| 32 |
-
const pdfText = document.getElementById('pdfText').value;
|
| 33 |
-
|
| 34 |
-
// Prepare the request payload
|
| 35 |
-
const payload = {
|
| 36 |
-
pdftext: pdfText
|
| 37 |
-
};
|
| 38 |
|
| 39 |
try {
|
| 40 |
// Send POST request to the Flask endpoint
|
| 41 |
-
const response = await fetch('https://huggingface.co/spaces/
|
| 42 |
method: 'POST',
|
| 43 |
headers: {
|
| 44 |
'Content-Type': 'application/json'
|
|
@@ -46,30 +29,12 @@
|
|
| 46 |
body: JSON.stringify(payload)
|
| 47 |
});
|
| 48 |
|
| 49 |
-
// Parse and display the response
|
| 50 |
-
const result = await response.json();
|
| 51 |
-
document.getElementById('response').textContent = JSON.stringify(result, null, 2);
|
| 52 |
} catch (error) {
|
| 53 |
console.error('Error:', error);
|
| 54 |
document.getElementById('response').textContent = 'An error occurred.';
|
| 55 |
}
|
| 56 |
}
|
| 57 |
</script>
|
| 58 |
-
</head>
|
| 59 |
-
<body>
|
| 60 |
-
<div class="card">
|
| 61 |
-
<h1>Welcome to your static Space!</h1>
|
| 62 |
-
<p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
|
| 63 |
-
<p>
|
| 64 |
-
Also don't forget to check the
|
| 65 |
-
<a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
|
| 66 |
-
</p>
|
| 67 |
-
<div>
|
| 68 |
-
<h2>Send Data to Flask App</h2>
|
| 69 |
-
<textarea id="pdfText" rows="10" cols="30" placeholder="Enter text here..."></textarea><br/>
|
| 70 |
-
<button onclick="sendData()">Send Data</button>
|
| 71 |
-
<pre id="response"></pre>
|
| 72 |
-
</div>
|
| 73 |
-
</div>
|
| 74 |
-
</body>
|
| 75 |
</html>
|
|
|
|
|
|
|
|
|
| 1 |
+
<!doctype html>
|
| 2 |
<html>
|
| 3 |
<head>
|
| 4 |
<meta charset="utf-8" />
|
|
|
|
| 16 |
</p>
|
| 17 |
</div>
|
| 18 |
</body>
|
| 19 |
+
<script>
|
| 20 |
+
function sendData() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
try {
|
| 23 |
// Send POST request to the Flask endpoint
|
| 24 |
+
const response = await fetch('https://huggingface.co/spaces/Marthee/PDF_to_Text/process', {
|
| 25 |
method: 'POST',
|
| 26 |
headers: {
|
| 27 |
'Content-Type': 'application/json'
|
|
|
|
| 29 |
body: JSON.stringify(payload)
|
| 30 |
});
|
| 31 |
|
|
|
|
|
|
|
|
|
|
| 32 |
} catch (error) {
|
| 33 |
console.error('Error:', error);
|
| 34 |
document.getElementById('response').textContent = 'An error occurred.';
|
| 35 |
}
|
| 36 |
}
|
| 37 |
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
</html>
|
| 39 |
+
|
| 40 |
+
|