Spaces:
Running
Running
fistyee
commited on
Commit
·
595b6db
1
Parent(s):
d7e53f4
add viewer
Browse files- __pycache__/evaluation_processor.cpython-311.pyc +0 -0
- app.py +13 -6
- evaluation_processor.py +8 -1
- flagged/log.csv +20 -0
__pycache__/evaluation_processor.cpython-311.pyc
CHANGED
Binary files a/__pycache__/evaluation_processor.cpython-311.pyc and b/__pycache__/evaluation_processor.cpython-311.pyc differ
|
|
app.py
CHANGED
@@ -61,7 +61,9 @@ def process_input(text=None, images=None, audio=None, video=None):
|
|
61 |
"eva_note":按键
|
62 |
"eva_stability":稳定性
|
63 |
"eva_tempo_sync":节奏
|
64 |
-
几个方面评价一下下面这首曲子演奏的结果,
|
|
|
|
|
65 |
|
66 |
except Exception as e:
|
67 |
return f"Error processing audio: {e}", None
|
@@ -78,8 +80,9 @@ def process_input(text=None, images=None, audio=None, video=None):
|
|
78 |
"eva_note":按键
|
79 |
"eva_stability":稳定性
|
80 |
"eva_tempo_sync":节奏
|
81 |
-
几个方面评价一下下面这首曲子演奏的结果,
|
82 |
-
|
|
|
83 |
except Exception as e:
|
84 |
return f"Error processing video: {e}", None
|
85 |
|
@@ -96,11 +99,14 @@ def process_input(text=None, images=None, audio=None, video=None):
|
|
96 |
presence_penalty=0,
|
97 |
stop=None
|
98 |
)
|
99 |
-
|
100 |
-
|
101 |
except Exception as e:
|
102 |
return f"Error: {e}", None
|
103 |
|
|
|
|
|
|
|
104 |
# 创建Gradio接口
|
105 |
iface = gr.Interface(
|
106 |
fn=process_input,
|
@@ -111,7 +117,8 @@ iface = gr.Interface(
|
|
111 |
gr.File(label="Input Video", type="filepath") # 视频文件上传
|
112 |
],
|
113 |
outputs=[
|
114 |
-
gr.Textbox(label="Output Text")
|
|
|
115 |
],
|
116 |
live=False,
|
117 |
)
|
|
|
61 |
"eva_note":按键
|
62 |
"eva_stability":稳定性
|
63 |
"eva_tempo_sync":节奏
|
64 |
+
几个方面评价一下下面这首曲子演奏的结果, 不用提及键的英文,使用中文,曲子为 {result}'''
|
65 |
+
result_path = result.get('result_path', '')
|
66 |
+
|
67 |
|
68 |
except Exception as e:
|
69 |
return f"Error processing audio: {e}", None
|
|
|
80 |
"eva_note":按键
|
81 |
"eva_stability":稳定性
|
82 |
"eva_tempo_sync":节奏
|
83 |
+
几个方面评价一下下面这首曲子演奏的结果, 不用提及键的英文,使用中文,曲子为 {result}'''
|
84 |
+
result_path = result.get('result_path', '')
|
85 |
+
|
86 |
except Exception as e:
|
87 |
return f"Error processing video: {e}", None
|
88 |
|
|
|
99 |
presence_penalty=0,
|
100 |
stop=None
|
101 |
)
|
102 |
+
results = response.choices[0].message.content
|
103 |
+
|
104 |
except Exception as e:
|
105 |
return f"Error: {e}", None
|
106 |
|
107 |
+
html_output = f"""<iframe src="{result_path}" width="100%" height="600"></iframe>""" if result_path else ""
|
108 |
+
return results, html_output
|
109 |
+
|
110 |
# 创建Gradio接口
|
111 |
iface = gr.Interface(
|
112 |
fn=process_input,
|
|
|
117 |
gr.File(label="Input Video", type="filepath") # 视频文件上传
|
118 |
],
|
119 |
outputs=[
|
120 |
+
gr.Textbox(label="Output Text"),
|
121 |
+
gr.HTML(label="Webpage")
|
122 |
],
|
123 |
live=False,
|
124 |
)
|
evaluation_processor.py
CHANGED
@@ -40,8 +40,13 @@ class EvaluationProcessor:
|
|
40 |
def submit_evaluation(self, file_path, music_id=None, hand=-1, order_start=0, order_end=-1, repeat_type=0, is_video=False):
|
41 |
url = self.video_url if is_video else self.audio_url
|
42 |
|
|
|
|
|
|
|
|
|
|
|
43 |
files = {
|
44 |
-
'file': (
|
45 |
}
|
46 |
data = {
|
47 |
'musicId': music_id,
|
@@ -62,9 +67,11 @@ class EvaluationProcessor:
|
|
62 |
params = {'taskId': task_id}
|
63 |
while True:
|
64 |
result_response = requests.get(self.result_url, headers=self.headers, params=params)
|
|
|
65 |
if result_response.status_code == 200:
|
66 |
result_data = result_response.json()
|
67 |
status = result_data['data']['status']
|
|
|
68 |
if status in ['pending', 'processing']:
|
69 |
print(f'Task is still {status}...')
|
70 |
time.sleep(2)
|
|
|
40 |
def submit_evaluation(self, file_path, music_id=None, hand=-1, order_start=0, order_end=-1, repeat_type=0, is_video=False):
|
41 |
url = self.video_url if is_video else self.audio_url
|
42 |
|
43 |
+
# 根据文件类型选择 MIME 类型
|
44 |
+
file_type = 'video/mp4' if is_video else 'audio/mp3'
|
45 |
+
file_name = "video_file.mp4" if is_video else "audio_file.mp3"
|
46 |
+
|
47 |
+
# 打开文件并指定文件类型
|
48 |
files = {
|
49 |
+
'file': (file_name, open(file_path, 'rb'), file_type)
|
50 |
}
|
51 |
data = {
|
52 |
'musicId': music_id,
|
|
|
67 |
params = {'taskId': task_id}
|
68 |
while True:
|
69 |
result_response = requests.get(self.result_url, headers=self.headers, params=params)
|
70 |
+
print(result_response)
|
71 |
if result_response.status_code == 200:
|
72 |
result_data = result_response.json()
|
73 |
status = result_data['data']['status']
|
74 |
+
print(result_data)
|
75 |
if status in ['pending', 'processing']:
|
76 |
print(f'Task is still {status}...')
|
77 |
time.sleep(2)
|
flagged/log.csv
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Input Text,Input Images,Input Audio,Input Video,Output Text,flag,username,timestamp
|
2 |
+
,,,,,,,2024-10-06 12:43:10.987424
|
3 |
+
,,,flagged/Input Video/213faeb4ab51a3c03635/c.mp4,"这首曲子《梦中的婚礼》的演奏结果可以从以下几个方面进行评价:
|
4 |
+
|
5 |
+
1. 综合得分:0.858,整体表现良好,显示出演奏者对曲目的理解和掌握。
|
6 |
+
2. 完整性:1.0,演奏非常完整,没有明显的遗漏或错误,展现了高水平的演奏技巧。
|
7 |
+
3. 按键:0.833,按键的准确性较高,但仍有提升空间,可能在某些细节上需要更加精确。
|
8 |
+
4. 稳定性:0.969,演奏的稳定性非常好,节奏和音高保持了一致性,给人一种流畅的感觉。
|
9 |
+
5. 节奏:0.776,节奏的把握稍显不足,可能在某些段落中存在轻微的节奏波动。
|
10 |
+
|
11 |
+
详细评测内容的地址是:https://test.aitanzou.com/webview/evalresult.html?user_id=9&sequence_id=7e1fa4e1-8c17-4803-aa0f-9e307630a88a","<iframe src=""https://test.aitanzou.com/webview/evalresult.html?user_id=9&sequence_id=7e1fa4e1-8c17-4803-aa0f-9e307630a88a"" width=""100%"" height=""600""></iframe>",,,2024-10-06 12:57:07.083856
|
12 |
+
,,,flagged/Input Video/6b1b77560718f37e24ae/c.mp4,"这首曲子《梦中的婚礼》的演奏结果可以从以下几个方面进行评价:
|
13 |
+
|
14 |
+
1. 综合得分:0.858,整体表现良好,显示出演奏者对曲目的理解和掌握。
|
15 |
+
2. 完整性:1.0,演奏非常完整,没有明显的遗漏或错误,展现了高水平的演奏技巧。
|
16 |
+
3. 按键:0.833,按键的准确性较高,但仍有提升空间,可能在某些细节上需要更加精确。
|
17 |
+
4. 稳定性:0.969,演奏的稳定性非常好,节奏和音高保持了一致性,给人一种流畅的感觉。
|
18 |
+
5. 节奏:0.776,节奏的把握稍显不足,可能在某些段落中存在轻微的节奏波动。
|
19 |
+
|
20 |
+
详细评测内容的地址是:https://test.aitanzou.com/webview/evalresult.html?user_id=9&sequence_id=7e1fa4e1-8c17-4803-aa0f-9e307630a88a","<iframe src=""https://test.aitanzou.com/webview/evalresult.html?user_id=9&sequence_id=7e1fa4e1-8c17-4803-aa0f-9e307630a88a"" width=""100%"" height=""600""></iframe>",,,2024-10-06 12:57:15.543789
|