Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,7 +7,7 @@ from huggingface_hub import login
|
|
| 7 |
import os
|
| 8 |
|
| 9 |
# ========== 使用你的 secret 名称 fmv 登录 ==========
|
| 10 |
-
token = os.getenv("fmv")
|
| 11 |
if token:
|
| 12 |
login(token=token)
|
| 13 |
print("成功使用 token 登录!")
|
|
@@ -95,17 +95,15 @@ def gradio_interface(image):
|
|
| 95 |
result = predict(image)
|
| 96 |
return result
|
| 97 |
|
| 98 |
-
# 创建 Gradio 界面
|
| 99 |
interface = gr.Interface(
|
| 100 |
fn=gradio_interface,
|
| 101 |
inputs=gr.Image(type="pil", label="上传火灾图片"),
|
| 102 |
outputs=gr.Textbox(label="AI 分析结果", lines=10),
|
| 103 |
title="🔥 火灾场景智能分析系统",
|
| 104 |
-
description="上传火灾相关图片,AI 将自动分析并描述火灾情况。"
|
| 105 |
-
theme=gr.themes.Soft(),
|
| 106 |
-
allow_flagging="never"
|
| 107 |
)
|
| 108 |
|
| 109 |
-
# 启动接口
|
| 110 |
if __name__ == "__main__":
|
| 111 |
-
interface.launch()
|
|
|
|
| 7 |
import os
|
| 8 |
|
| 9 |
# ========== 使用你的 secret 名称 fmv 登录 ==========
|
| 10 |
+
token = os.getenv("fmv")
|
| 11 |
if token:
|
| 12 |
login(token=token)
|
| 13 |
print("成功使用 token 登录!")
|
|
|
|
| 95 |
result = predict(image)
|
| 96 |
return result
|
| 97 |
|
| 98 |
+
# 创建 Gradio 界面 (移除了 theme 和 allow_flagging)
|
| 99 |
interface = gr.Interface(
|
| 100 |
fn=gradio_interface,
|
| 101 |
inputs=gr.Image(type="pil", label="上传火灾图片"),
|
| 102 |
outputs=gr.Textbox(label="AI 分析结果", lines=10),
|
| 103 |
title="🔥 火灾场景智能分析系统",
|
| 104 |
+
description="上传火灾相关图片,AI 将自动分析并描述火灾情况。"
|
|
|
|
|
|
|
| 105 |
)
|
| 106 |
|
| 107 |
+
# 启动接口 (把 theme 移到这里)
|
| 108 |
if __name__ == "__main__":
|
| 109 |
+
interface.launch(share=False)
|