mgokg commited on
Commit
a1b01e6
·
verified ·
1 Parent(s): 44e506e

Create fa.html

Browse files
Files changed (1) hide show
  1. fa.html +39 -0
fa.html ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.0">
6
+ <title>Textfeld mit FastAPI</title>
7
+ </head>
8
+ <body>
9
+ <h1>Textfeld mit FastAPI</h1>
10
+ <form id="myForm">
11
+ <label for="prompt">Prompt:</label>
12
+ <input type="text" id="prompt" name="prompt">
13
+ <button type="button" onclick="sendData()">Senden</button>
14
+ </form>
15
+
16
+ <script>
17
+ async function sendData() {
18
+ const prompt = document.getElementById("prompt").value;
19
+ const zeitstempel = Math.floor(Date.now() / 1000); // Unix-Zeitstempel
20
+
21
+ const data = {
22
+ prompt: prompt,
23
+ zeitstempel: zeitstempel
24
+ };
25
+
26
+ const response = await fetch("http://localhost:8000/items/", {
27
+ method: "POST",
28
+ headers: {
29
+ "Content-Type": "application/json"
30
+ },
31
+ body: JSON.stringify(data)
32
+ });
33
+
34
+ const result = await response.json();
35
+ console.log(result);
36
+ }
37
+ </script>
38
+ </body>
39
+ </html>