stcoats commited on
Commit
e7f7015
Β·
1 Parent(s): 004296d

Add FastAPI viewer structure

Browse files
Files changed (4) hide show
  1. Dockerfile +17 -0
  2. README.md +2 -1
  3. frontend/index.html +0 -24
  4. frontend/js/app.js +0 -28
Dockerfile ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10-slim
2
+
3
+ WORKDIR /app
4
+
5
+ # Install dependencies
6
+ COPY requirements.txt .
7
+ RUN pip install --no-cache-dir -r requirements.txt
8
+
9
+ # Copy application files
10
+ COPY app/ app/
11
+
12
+ # Expose port
13
+ EXPOSE 7860
14
+
15
+ # Run FastAPI app
16
+ CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
17
+
README.md CHANGED
@@ -3,7 +3,8 @@ title: Ycsep Fastapi Viewer
3
  emoji: πŸ‘€
4
  colorFrom: pink
5
  colorTo: yellow
6
- sdk: static
 
7
  pinned: false
8
  ---
9
 
 
3
  emoji: πŸ‘€
4
  colorFrom: pink
5
  colorTo: yellow
6
+ sdk: docker
7
+ app_file: app/main.py
8
  pinned: false
9
  ---
10
 
frontend/index.html DELETED
@@ -1,24 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta charset="UTF-8">
5
- <title>YCSEP Viewer</title>
6
- <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
7
- <link rel="stylesheet" href="https://cdn.datatables.net/1.13.5/css/jquery.dataTables.min.css">
8
- <script src="https://cdn.datatables.net/1.13.5/js/jquery.dataTables.min.js"></script>
9
- <script src="js/app.js"></script>
10
- </head>
11
- <body>
12
- <h2>YCSEP Audio Dataset Viewer</h2>
13
- <input type="text" id="searchBox" placeholder="Search text..." style="width:300px; margin-bottom:10px;">
14
- <table id="resultsTable" class="display" style="width:100%">
15
- <thead>
16
- <tr>
17
- <th>ID</th><th>Channel</th><th>Video ID</th><th>Speaker</th><th>Start</th><th>End</th><th>Upload Date</th><th>Text</th><th>POS</th><th>Audio</th>
18
- </tr>
19
- </thead>
20
- <tbody></tbody>
21
- </table>
22
- </body>
23
- </html>
24
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
frontend/js/app.js DELETED
@@ -1,28 +0,0 @@
1
- $(document).ready(function () {
2
- function fetchResults(query) {
3
- $.get(`/search?text=${encodeURIComponent(query)}`, function (data) {
4
- const table = $('#resultsTable').DataTable();
5
- table.clear();
6
- data.forEach(row => {
7
- const audioHtml = `<audio controls preload="metadata" style="height:20px; width:120px;">
8
- <source src="/audio/${row.id}" type="audio/mpeg"></audio>`;
9
- table.row.add([
10
- row.id, row.channel, row.video_id, row.speaker,
11
- row.start_time, row.end_time, row.upload_date,
12
- row.text, row.pos_tags, audioHtml
13
- ]);
14
- });
15
- table.draw();
16
- });
17
- }
18
-
19
- $('#resultsTable').DataTable();
20
- $('#searchBox').on('input', function () {
21
- const query = $(this).val();
22
- fetchResults(query);
23
- });
24
-
25
- // Initial empty fetch
26
- fetchResults('');
27
- });
28
-