File size: 1,054 Bytes
1a3838c
 
9d444ef
1a3838c
 
9d444ef
1a3838c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# import evaluate
# from evaluate.utils import launch_gradio_widget

# module = evaluate.load("SEA-AI/PanopticQuality")
# launch_gradio_widget(module)

from pathlib import Path
import sys
import gradio as gr


def read_markdown(filepath):
    with open(filepath, 'r') as file:
        lines = file.readlines()
        start_index = None
        end_index = None
        for i, line in enumerate(lines):
            if line.strip() == '---':
                if start_index is None:
                    start_index = i
                else:
                    end_index = i
                    break
        if end_index is None:
            return ''.join(
                lines)  # If no end delimiter found, return entire content
        else:
            return ''.join(lines[end_index +
                                 1:])  # Return content after end delimiter


local_path = Path(sys.path[0])
filepath = local_path / "README.md"
markdown_content = read_markdown(filepath)

with gr.Blocks() as demo:
    gr.Markdown(markdown_content)

demo.launch()