Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
refactor: Improve asset information display with markdown table format
Browse files
app.py
CHANGED
@@ -85,16 +85,17 @@ def get_files_infos(files):
|
|
85 |
|
86 |
|
87 |
def get_completion(prompt, files_info, top_p, temperature):
|
88 |
-
|
|
|
|
|
|
|
|
|
89 |
for file_info in files_info:
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
if file_info["type"] == "audio" or file_info["type"] == "video/audio":
|
96 |
-
files_info_string += f""" {file_info["audio_channels"]} audio channels"""
|
97 |
-
files_info_string += "\n"
|
98 |
|
99 |
messages = [
|
100 |
{
|
|
|
85 |
|
86 |
|
87 |
def get_completion(prompt, files_info, top_p, temperature):
|
88 |
+
# Create table header
|
89 |
+
files_info_string = "| Type | Name | Dimensions | Duration | Audio |\n"
|
90 |
+
files_info_string += "|------|------|------------|-----------|--------|\n"
|
91 |
+
|
92 |
+
# Add each file as a table row
|
93 |
for file_info in files_info:
|
94 |
+
dimensions = file_info.get("dimensions", "-")
|
95 |
+
duration = f"{file_info.get('duration', '-')}s" if "duration" in file_info else "-"
|
96 |
+
audio = f"{file_info.get('audio_channels', '-')} channels" if "audio_channels" in file_info else "-"
|
97 |
+
|
98 |
+
files_info_string += f"| {file_info['type']} | {file_info['name']} | {dimensions} | {duration} | {audio} |\n"
|
|
|
|
|
|
|
99 |
|
100 |
messages = [
|
101 |
{
|