Spaces:
Running
Running
feifeinoban
commited on
Commit
·
5d326b7
1
Parent(s):
6ce3c38
Fix image path for Gradio rendering
Browse files
app.py
CHANGED
|
@@ -1,4 +1,12 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
def load_markdown():
|
| 4 |
with open("README.md", "r", encoding="utf-8") as f:
|
|
@@ -14,5 +22,8 @@ def load_markdown():
|
|
| 14 |
|
| 15 |
with gr.Blocks() as demo:
|
| 16 |
gr.Markdown(load_markdown())
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
demo.launch(allowed_paths=["./", "./assets"])
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
import os
|
| 3 |
+
|
| 4 |
+
# 调试:检查文件是否存在
|
| 5 |
+
print("当前目录内容:", os.listdir('.'))
|
| 6 |
+
if os.path.exists('assets'):
|
| 7 |
+
print("assets目录内容:", os.listdir('assets'))
|
| 8 |
+
else:
|
| 9 |
+
print("assets目录不存在")
|
| 10 |
|
| 11 |
def load_markdown():
|
| 12 |
with open("README.md", "r", encoding="utf-8") as f:
|
|
|
|
| 22 |
|
| 23 |
with gr.Blocks() as demo:
|
| 24 |
gr.Markdown(load_markdown())
|
| 25 |
+
# 测试直接显示图片
|
| 26 |
+
gr.HTML('<h3>测试图片显示:</h3>')
|
| 27 |
+
gr.HTML('<img src="/file=./assets/mentor_arch.png" style="max-width: 100%">')
|
| 28 |
|
| 29 |
demo.launch(allowed_paths=["./", "./assets"])
|