Spaces:
Running
Running
<html lang="ja" class="dark"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>会話フィードバック画面</title> | |
<script src="https://cdn.tailwindcss.com"></script> | |
<script> | |
tailwind.config = { | |
darkMode: "class", | |
}; | |
</script> | |
<script> | |
function getMessage(level) { | |
if (level < 20) return "やばい"; | |
if (level < 40) return "気をつけよう"; | |
if (level < 60) return "まずまずですね"; | |
if (level < 80) return "がんばれあとちょっと"; | |
return "素晴らしい"; | |
} | |
async function getTranscription(){ | |
try{ | |
const response = await fetch('/transcription'); | |
if(!response.ok){ | |
throw new Error('HTTP error! status: ${response.status}'); | |
} | |
const data = await response.json; | |
const results = data.response; | |
}catch(error){ | |
console.error("Failed to fetch transcription",error); | |
} | |
} | |
async function getAnalysis() { | |
try { | |
await getTranscription(); | |
const response = await fetch('/analyze'); | |
if (!response.ok) { | |
throw new Error(`HTTP error! status: ${response.status}`); | |
} | |
const data = await response.json(); | |
const results = data.results; | |
const analysis = results.deepseek_analysis; | |
// 変数に格納 | |
const conversationLevel = analysis.conversationLevel; | |
const harassmentPresent = analysis.harassmentPresent; | |
const harassmentType = analysis.harassmentType; | |
const repetition = analysis.repetition; | |
const pleasantConversation = analysis.pleasantConversation; | |
const blameOrHarassment = analysis.blameOrHarassment; | |
// コンソールに表示 | |
console.log(conversationLevel,harassmentPresent,harassmentType,repetition,pleasantConversation,blameOrHarassment); | |
} catch (error) { | |
console.error("Failed to fetch analysis data:", error); | |
} | |
} | |
window.onload = getAnalysis(); | |
function showSampleData() { | |
const level = 73; | |
const percentages = [80, 50, 60, 100, 30]; | |
const labels = ["項目1", "項目2", "項目3", "項目4", "項目5"]; | |
const message = getMessage(level); | |
document.getElementById("level").innerText = `話者Lv: ${level}`; | |
document.getElementById("message").innerText = message; | |
const barElements = document.getElementsByClassName("bar-fill"); | |
const labelElements = document.getElementsByClassName("bar-label"); | |
for (let i = 0; i < barElements.length; i++) { | |
barElements[i].style.width = `${percentages[i]}%`; | |
labelElements[i].innerText = labels[i]; | |
} | |
}; | |
function showRecorder() { | |
window.location.href = "index"; | |
} | |
function showTalkDetail() { | |
window.location.href = "talk_detail"; | |
} | |
</script> | |
</head> | |
<body | |
class="flex items-center justify-center min-h-screen bg-gray-900 text-white" | |
> | |
<div class="p-8 bg-gray-800 rounded-2xl shadow-xl text-center w-96"> | |
<div class="text-3xl font-bold mb-4" id="level">話者Lv: 85</div> | |
<div class="text-xl font-semibold mb-6" id="message">素晴らしい</div> | |
<div class="space-y-2"> | |
<div class="bar-container flex items-center"> | |
<span class="bar-label w-20 mr-2"></span> | |
<div class="bar w-full h-6 bg-gray-700 rounded-full overflow-hidden"> | |
<div class="bar-fill h-full bg-blue-500"></div> | |
</div> | |
</div> | |
<div class="bar-container flex items-center"> | |
<span class="bar-label w-20 mr-2"></span> | |
<div class="bar w-full h-6 bg-gray-700 rounded-full overflow-hidden"> | |
<div class="bar-fill h-full bg-orange-400"></div> | |
</div> | |
</div> | |
<div class="bar-container flex items-center"> | |
<span class="bar-label w-20 mr-2"></span> | |
<div class="bar w-full h-6 bg-gray-700 rounded-full overflow-hidden"> | |
<div class="bar-fill h-full bg-blue-500"></div> | |
</div> | |
</div> | |
<div class="bar-container flex items-center"> | |
<span class="bar-label w-20 mr-2"></span> | |
<div class="bar w-full h-6 bg-gray-700 rounded-full overflow-hidden"> | |
<div class="bar-fill h-full bg-orange-400"></div> | |
</div> | |
</div> | |
<div class="bar-container flex items-center"> | |
<span class="bar-label w-20 mr-2"></span> | |
<div class="bar w-full h-6 bg-gray-700 rounded-full overflow-hidden"> | |
<div class="bar-fill h-full bg-red-500"></div> | |
</div> | |
</div> | |
</div> | |
<div class="flex justify-center space-x-4 mt-6"> | |
<button | |
onclick="showRecorder()" | |
class="px-4 py-2 bg-blue-600 rounded-lg hover:bg-blue-700" | |
> | |
録音画面を表示 | |
</button> | |
<button | |
onclick="showTalkDetail()" | |
class="px-4 py-2 bg-blue-600 rounded-lg hover:bg-blue-700" | |
> | |
会話詳細を表示 | |
</button> | |
</div> | |
</div> | |
</body> | |
</html> | |