Greenniche commited on
Commit
200fd6e
1 Parent(s): 03d523b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -9
app.py CHANGED
@@ -1,12 +1,15 @@
1
- import spacy
2
-
3
- # 安装并加载模型
4
- model_name_or_path = "spacy/zh_core_web_sm"
5
- spacy.cli.download(model_name_or_path)
6
- nlp = spacy.load(model_name_or_path)
7
-
8
- # 在模型被成功加载之后,你就可以使用它来进行文本处理任务了
9
-
 
 
 
10
 
11
 
12
  import gradio as gr
 
1
+ import requests
2
+
3
+ API_URL = "https://api-inference.huggingface.co/models/spacy/zh_core_web_sm"
4
+ headers = {"Authorization": f"Bearer {API_TOKEN}"}
5
+
6
+ def query(payload):
7
+ response = requests.post(API_URL, headers=headers, json=payload)
8
+ return response.json()
9
+
10
+ output = query({
11
+ "inputs": "My name is Sarah Jessica Parker but you can call me Jessica",
12
+ })
13
 
14
 
15
  import gradio as gr