Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,19 +1,16 @@
|
|
1 |
-
import
|
2 |
-
import os
|
3 |
|
4 |
-
|
5 |
-
|
6 |
-
HF_API_TOKEN = os.getenv("HF_API_TOKEN") # 從環境變數讀取 API token
|
7 |
-
headers = {"Authorization": f"Bearer {HF_API_TOKEN}"}
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
14 |
|
15 |
-
#
|
16 |
-
|
17 |
-
|
18 |
-
# 打印結果
|
19 |
-
print(output)
|
|
|
1 |
+
import gradio as gr
|
|
|
2 |
|
3 |
+
def greet(name):
|
4 |
+
return f"Hello {name}!"
|
|
|
|
|
5 |
|
6 |
+
# 創建 Gradio 介面
|
7 |
+
interface = gr.Interface(
|
8 |
+
fn=greet,
|
9 |
+
inputs="text",
|
10 |
+
outputs="text",
|
11 |
+
title="簡單應用測試",
|
12 |
+
description="輸入一個名稱,返回問候語"
|
13 |
+
)
|
14 |
|
15 |
+
# 啟動 Gradio 應用
|
16 |
+
interface.launch()
|
|
|
|
|
|