Zwicii commited on
Commit
1a6307a
1 Parent(s): a5e0313

remove default gradio input/output and replace it with markdown view

Browse files
Files changed (1) hide show
  1. app.py +31 -4
app.py CHANGED
@@ -1,6 +1,33 @@
1
- import evaluate
2
- from evaluate.utils import launch_gradio_widget
 
3
 
4
 
5
- module = evaluate.load("SEA-AI/det-metrics")
6
- launch_gradio_widget(module)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pathlib import Path
2
+ import sys
3
+ import gradio as gr
4
 
5
 
6
+ def read_markdown(filepath):
7
+ with open(filepath, 'r') as file:
8
+ lines = file.readlines()
9
+ start_index = None
10
+ end_index = None
11
+ for i, line in enumerate(lines):
12
+ if line.strip() == '---':
13
+ if start_index is None:
14
+ start_index = i
15
+ else:
16
+ end_index = i
17
+ break
18
+ if end_index is None:
19
+ return ''.join(
20
+ lines) # If no end delimiter found, return entire content
21
+ else:
22
+ return ''.join(lines[end_index +
23
+ 1:]) # Return content after end delimiter
24
+
25
+
26
+ local_path = Path(sys.path[0])
27
+ filepath = local_path / "README.md"
28
+ markdown_content = read_markdown(filepath)
29
+
30
+ with gr.Blocks() as demo:
31
+ gr.Markdown(markdown_content)
32
+
33
+ demo.launch()