Spaces:
Running
Running
feifeinoban
commited on
Commit
·
d5d7757
1
Parent(s):
4e38568
Add app.py for HF Space
Browse files
app.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
def load_markdown():
|
| 4 |
+
with open("README.md", "r", encoding="utf-8") as f:
|
| 5 |
+
content = f.read()
|
| 6 |
+
|
| 7 |
+
# 跳过YAML frontmatter
|
| 8 |
+
if content.startswith("---"):
|
| 9 |
+
parts = content.split("---", 2)
|
| 10 |
+
if len(parts) >= 3:
|
| 11 |
+
return parts[2].strip()
|
| 12 |
+
|
| 13 |
+
return content
|
| 14 |
+
|
| 15 |
+
with gr.Blocks() as demo:
|
| 16 |
+
gr.Markdown(load_markdown())
|
| 17 |
+
|
| 18 |
+
demo.launch()
|