Spaces:
Runtime error
Runtime error
gorkaartola
commited on
Commit
•
a3ecf62
1
Parent(s):
9f8d320
Update app.py
Browse files
app.py
CHANGED
@@ -1,9 +1,20 @@
|
|
1 |
import gradio as gr
|
2 |
import run
|
3 |
import options as op
|
|
|
4 |
|
5 |
-
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
iface = gr.Interface(
|
9 |
run.tp_tf_test,
|
|
|
1 |
import gradio as gr
|
2 |
import run
|
3 |
import options as op
|
4 |
+
import re
|
5 |
|
6 |
+
REGEX_YAML_BLOCK = re.compile(r"---[\n\r]+([\S\s]*?)[\n\r]+---[\n\r]")
|
7 |
+
|
8 |
+
def parse_readme(filepath):
|
9 |
+
"""Parses a repositories README and removes"""
|
10 |
+
if not os.path.exists(filepath):
|
11 |
+
return "No README.md found."
|
12 |
+
with open(filepath, "r") as f:
|
13 |
+
text = f.read()
|
14 |
+
match = REGEX_YAML_BLOCK.search(text)
|
15 |
+
if match:
|
16 |
+
text = text[match.end() :]
|
17 |
+
return text
|
18 |
|
19 |
iface = gr.Interface(
|
20 |
run.tp_tf_test,
|