Greenniche commited on
Commit
4c5c127
1 Parent(s): 200fd6e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -10
app.py CHANGED
@@ -1,17 +1,14 @@
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
16
  import textdistance
17
 
 
 
1
 
 
 
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
+ import spacy
12
  import gradio as gr
13
  import textdistance
14