Spaces:
Running
Running
Rem“
Browse files
README.md
CHANGED
|
@@ -1,21 +1,11 @@
|
|
| 1 |
---
|
| 2 |
-
title: Shell
|
| 3 |
emoji: 🐚
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: purple
|
| 6 |
-
sdk:
|
| 7 |
-
|
| 8 |
-
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
-
tags:
|
| 11 |
-
- llm-safety
|
| 12 |
-
- metacognition
|
| 13 |
-
- education
|
| 14 |
-
- finance
|
| 15 |
-
- management
|
| 16 |
-
- alignment
|
| 17 |
-
- activation-steering
|
| 18 |
-
short_description: Metacognition-driven safety for domain-specific LLMs
|
| 19 |
---
|
| 20 |
|
| 21 |
# 🐚 Shell: A Metacognition-Driven Safety Framework for Domain-Specific LLMs
|
|
|
|
| 1 |
---
|
| 2 |
+
title: Shell
|
| 3 |
emoji: 🐚
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: purple
|
| 6 |
+
sdk: static
|
| 7 |
+
app_file: index.html
|
|
|
|
| 8 |
pinned: false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
---
|
| 10 |
|
| 11 |
# 🐚 Shell: A Metacognition-Driven Safety Framework for Domain-Specific LLMs
|
app.py
DELETED
|
@@ -1,39 +0,0 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
-
import markdown
|
| 3 |
-
import re
|
| 4 |
-
|
| 5 |
-
def convert_markdown_to_html():
|
| 6 |
-
with open("README.md", "r", encoding="utf-8") as f:
|
| 7 |
-
content = f.read()
|
| 8 |
-
|
| 9 |
-
# 跳过YAML frontmatter
|
| 10 |
-
if content.startswith("---"):
|
| 11 |
-
parts = content.split("---", 2)
|
| 12 |
-
if len(parts) >= 3:
|
| 13 |
-
content = parts[2].strip()
|
| 14 |
-
|
| 15 |
-
# 修复图片路径为绝对URL
|
| 16 |
-
def fix_image_paths(match):
|
| 17 |
-
alt_text = match.group(1) or ""
|
| 18 |
-
path = match.group(2)
|
| 19 |
-
|
| 20 |
-
if not path.startswith(("http://", "https://")):
|
| 21 |
-
path = f"https://huggingface.co/spaces/feifeinoban/shell/resolve/main/{path.lstrip('./')}"
|
| 22 |
-
|
| 23 |
-
return f''
|
| 24 |
-
|
| 25 |
-
content = re.sub(r'!\[(.*?)\]\((.*?)\)', fix_image_paths, content)
|
| 26 |
-
|
| 27 |
-
# 将Markdown转换为HTML
|
| 28 |
-
html_content = markdown.markdown(content, extensions=['tables', 'fenced_code'])
|
| 29 |
-
|
| 30 |
-
return html_content
|
| 31 |
-
|
| 32 |
-
with gr.Blocks() as demo:
|
| 33 |
-
gr.HTML("""
|
| 34 |
-
<div style="max-width: 900px; margin: 0 auto; padding: 20px; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;">
|
| 35 |
-
""")
|
| 36 |
-
gr.HTML(convert_markdown_to_html())
|
| 37 |
-
gr.HTML("</div>")
|
| 38 |
-
|
| 39 |
-
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|