litagin commited on
Commit
2ba7a9a
1 Parent(s): 4b1510d
Files changed (3) hide show
  1. .gitignore +1 -0
  2. app.py +78 -0
  3. requirements.txt +2 -0
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ .venv
app.py ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import pandas as pd
3
+
4
+ # データを読み込む
5
+ df = pd.read_csv(
6
+ "https://huggingface.co/datasets/litagin/Galgame_Dataset_stats/resolve/main/data.tsv",
7
+ sep="\t",
8
+ )
9
+ # All numbers to .2f
10
+ df = df.round(2)
11
+ # Rename columns
12
+ print(df.columns)
13
+ df.columns = [
14
+ "game_name",
15
+ "speakers",
16
+ "mono",
17
+ "stereo",
18
+ "error",
19
+ "duration",
20
+ "sr",
21
+ "precision",
22
+ "bitrate",
23
+ "codec",
24
+ "total_size_MB",
25
+ ]
26
+
27
+
28
+ def create_image_md(game_name, spec_num):
29
+ url = f"https://huggingface.co/datasets/litagin/Galgame_Dataset_stats/resolve/main/specs/{game_name}/spec{spec_num}.png"
30
+
31
+ return f"![spec{spec_num}]({url})"
32
+
33
+
34
+ # 新しい列を追加
35
+ for i in range(1, 6):
36
+ df[f"spec{i}"] = df["game_name"].apply(lambda x: create_image_md(x, i))
37
+
38
+ # 必要な列だけを選択
39
+ df_display = df[
40
+ [
41
+ "game_name",
42
+ "speakers",
43
+ "mono",
44
+ "stereo",
45
+ "bitrate",
46
+ "sr",
47
+ "spec1",
48
+ "spec2",
49
+ "spec3",
50
+ "spec4",
51
+ "spec5",
52
+ ]
53
+ ]
54
+
55
+ with gr.Blocks() as app:
56
+ gr.Markdown("Hello")
57
+ gr.DataFrame(
58
+ df_display,
59
+ elem_id="df",
60
+ datatype=[
61
+ "str",
62
+ "number",
63
+ "number",
64
+ "number",
65
+ "number",
66
+ "number",
67
+ "markdown",
68
+ "markdown",
69
+ "markdown",
70
+ "markdown",
71
+ "markdown",
72
+ ],
73
+ column_widths=[100, 100, 100, 100, 100, 100, 300, 300, 300, 300, 300],
74
+ wrap=True,
75
+ height=800,
76
+ )
77
+
78
+ app.launch(inbrowser=True)
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ gradio
2
+ pandas