网页上看GPU情况
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

28 lines
964 B

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Fetch JSON from Flask</title>
</head>
<body>
<h1>Fetch JSON from Flask Example</h1>
<button onclick="fetchData()">Fetch Data</button>
<div id="output"></div>
<script>
function fetchData() {
fetch('http://127.0.0.1:15002/data') // 发起 GET 请求到 Flask 服务器的 '/get_data' 路径
.then(response => response.json()) // 解析 JSON 响应
.then(data => {
// 处理 JSON 数据
console.log(data);
document.getElementById('output').innerHTML = '<pre>' + JSON.stringify(data, null, 2) + '</pre>';
})
.catch(error => {
console.error('Error fetching data:', error);
});
}
</script>
</body>
</html>