File size: 5,746 Bytes
fa2c805
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<!DOCTYPE html>
<html lang="tr">
<head>
    <meta charset="UTF-8">
    <title>🎙️Transkript</title>
    <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
    <style>
        html, body {
            margin: 0;
            padding: 0;
            height: 100%;
            font-family: "cursive";
            overflow: hidden;
            display: flex;
            justify-content: center;
            align-items: center;
        }
        #particles-js {
            position: fixed;
            width: 100%;
            height: 100%;
            background-color: #0d1b2a;
            z-index: -1;
        }
        .container {
            max-width: 1000px;
            width: 95%;
            background: rgba(176, 26, 26, 0.459);
            padding: 50px;
            border-radius: 20px;
            box-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
            z-index: 1;
            color: #fff;
        }
        .output-box {
            margin-top: 15px;
            background: #e9ecef;
            padding: 10px;
            border-radius: 10px;
            white-space: pre-wrap;
            max-height: 300px;
            overflow-y: auto;
            color: #000;
        }
        .progress-wrapper {
            display: none;
            margin-top: 15px;
        }
        .progress-bar {
            background-color: green;
            text-align: center;
            color: white;
        }
    </style>
</head>
<body>
    <div id="particles-js"></div>

    <div class="container">
        <h2 class="text-center mb-4">🎙️ Ses Dosyasını Metne Dönüştür</h2>

        <div class="mb-3">
            <label for="file" class="form-label">Ses Dosyası Seç (.mp3)</label>
            <input class="form-control" type="file" name="file" id="file" required>
        </div>

        <div class="progress-wrapper">
            <div id="progress-bar" class="progress-bar" style="width:0%">0%</div>
        </div>

        <div class="d-grid">
            <button id="uploadBtn" class="btn btn-primary btn-lg">Yükle ve Dönüştür</button>
        </div>

        <div id="result"></div>
    </div>

    <p style="position: fixed; bottom: 20px; left: 20px; color:#ffffff;">Designer by: Burak Tuğrul Aşık & Tarık Kahraman</p>

    <script src="https://cdn.jsdelivr.net/npm/particles.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
    <script>
        particlesJS('particles-js', {
            "particles": {
                "number": { "value": 90, "density": { "enable": true, "value_area": 800 } },
                "color": { "value": "#ffffff" },
                "shape": { "type": "star", "stroke": { "width": 0, "color": "#ffffff" }, "polygon": { "nb_sides": 5 } },
                "opacity": { "value": 0.5, "random": false },
                "size": { "value": 3, "random": false },
                "line_linked": { "enable": true, "distance": 150, "color": "#ffffff", "opacity": 0.4, "width": 1 },
                "move": { "enable": true, "speed": 1, "direction": "none", "random": false, "straight": false, "out_mode": "out", "bounce": false }
            },
            "interactivity": {
                "detect_on": "canvas",
                "events": {
                    "onhover": { "enable": true, "mode": "repulse" },
                    "onclick": { "enable": true, "mode": "push" },
                    "resize": true
                },
                "modes": {
                    "repulse": { "distance": 100, "duration": 0.4 },
                    "push": { "particles_nb": 4 }
                }
            },
            "retina_detect": true
        });

        $("#uploadBtn").click(function(e) {
            e.preventDefault();
            var fileInput = $("#file")[0].files[0];
            if (!fileInput) {
                alert("Lütfen bir dosya seçin!");
                return;
            }
            var formData = new FormData();
            formData.append("file", fileInput);

            $(".progress-wrapper").show();
            $("#progress-bar").css("width", "0%").text("0%");
            $("#result").html("");

            $.ajax({
                xhr: function() {
                    var xhr = new window.XMLHttpRequest();
                    xhr.upload.addEventListener("progress", function(e) {
                        if (e.lengthComputable) {
                            var percent = Math.round((e.loaded / e.total) * 100);
                            $("#progress-bar").css("width", percent + "%").text(percent + "%");
                        }
                    });
                    return xhr;
                },
                type: "POST",
                url: "/",
                data: formData,
                processData: false,
                contentType: false,
                success: function(response) {
                    if (response.error) {
                        $("#result").html(`<p style="color:red;">${response.error}</p>`);
                        return;
                    }
                    $("#progress-bar").css("width", "100%").text("100%");
                    $("#result").html(
                        `<div class="output-box">
                            <h5>🎧 Dönüştürülen Metin:</h5>
                            <p>${response.metin}</p>
                            <h5>📝 Metnin Özeti:</h5>
                            <p>${response.ozet}</p>
                        </div>`
                    );
                },
                error: function() {
                    alert("Bir hata oluştu.");
                }
            });
        });
    </script>
</body>
</html>