Spaces:
Running
on
Zero
Running
on
Zero
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -222,23 +222,25 @@ demo = gr.ChatInterface(
|
|
| 222 |
additional_inputs_accordion=gr.Accordion(label="⚙️ Generation Config", open=True), # 设置配置区域
|
| 223 |
examples=examples_data, # 添加示例
|
| 224 |
cache_examples=False, # 根据需要开启或关闭
|
| 225 |
-
theme=gr.themes.Soft(),
|
| 226 |
-
css=CUSTOM_CSS
|
| 227 |
)
|
| 228 |
|
| 229 |
# ==========================================
|
| 230 |
# 6. 启动 Launch
|
| 231 |
# ==========================================
|
| 232 |
if __name__ == "__main__":
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 233 |
if is_spaces:
|
| 234 |
-
print(f"🚀 Running on Hugging Face Spaces
|
| 235 |
-
demo.launch(
|
| 236 |
-
allowed_paths=[PROJECT_DIR] # 允许访问本地图片资源
|
| 237 |
-
)
|
| 238 |
else:
|
| 239 |
-
print(f"🚀
|
| 240 |
demo.launch(
|
| 241 |
server_name="0.0.0.0",
|
| 242 |
server_port=7860,
|
| 243 |
-
|
| 244 |
)
|
|
|
|
| 222 |
additional_inputs_accordion=gr.Accordion(label="⚙️ Generation Config", open=True), # 设置配置区域
|
| 223 |
examples=examples_data, # 添加示例
|
| 224 |
cache_examples=False, # 根据需要开启或关闭
|
|
|
|
|
|
|
| 225 |
)
|
| 226 |
|
| 227 |
# ==========================================
|
| 228 |
# 6. 启动 Launch
|
| 229 |
# ==========================================
|
| 230 |
if __name__ == "__main__":
|
| 231 |
+
aunch_kwargs = {
|
| 232 |
+
"theme": gr.themes.Soft(),
|
| 233 |
+
"css": CUSTOM_CSS,
|
| 234 |
+
"allowed_paths": [PROJECT_DIR]
|
| 235 |
+
}
|
| 236 |
+
|
| 237 |
if is_spaces:
|
| 238 |
+
print(f"🚀 Running on Hugging Face Spaces")
|
| 239 |
+
demo.launch(**launch_kwargs)
|
|
|
|
|
|
|
| 240 |
else:
|
| 241 |
+
print(f"🚀 Running locally")
|
| 242 |
demo.launch(
|
| 243 |
server_name="0.0.0.0",
|
| 244 |
server_port=7860,
|
| 245 |
+
**launch_kwargs
|
| 246 |
)
|