-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
47 lines (45 loc) · 1.73 KB
/
Copy pathindex.html
File metadata and controls
47 lines (45 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My GitHub Page with FastAPI</title>
<style>
body { font-family: Arial, sans-serif; text-align: center; margin-top: 50px; }
</style>
</head>
<body>
<h1>Welcome to My GitHub Page!</h1>
<h2>Feedback Form</h2>
<form action="/submit-feedback" method="post">
<label for="name">Name:</label>
<input type="text" id="name" name="name" required><br><br>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required><br><br>
<label for="feedback">Feedback:</label><br>
<textarea id="feedback" name="feedback" rows="4" cols="50" required></textarea><br><br>
<input type="submit" value="Submit">
</form>
<br>
<p id="response">Fetching data...</p>
<script>
async function fetchData() {
try {
const response = await fetch('http://your-fastapi-server.com/process-nlp/', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YvZz9Hni0hWJPh_UWW4dQYf9rhIe9nNYcC5ZQTTZz0Q' // Replace with your actual secure token
},
body: JSON.stringify({ text: "Hello FastAPI" })
});
const data = await response.json();
document.getElementById('response').innerText = data.response;
} catch (error) {
document.getElementById('response').innerText = 'Error fetching data';
}
}
fetchData();
</script>
</body>
</html>