Spaces:
Sleeping
Sleeping
Shunfeng Zheng
commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,26 +2,28 @@ import gradio as gr
|
|
| 2 |
import time # 模拟处理耗时
|
| 3 |
import os
|
| 4 |
import spacy
|
|
|
|
|
|
|
| 5 |
os.system("python -m spacy download en_core_web_md")
|
| 6 |
|
| 7 |
nlp = spacy.load("en_core_web_md")
|
| 8 |
-
def process_api(input_text):
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
# 设置API格式为JSON
|
| 18 |
-
gr.Interface(
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
).launch()
|
| 25 |
|
| 26 |
|
| 27 |
# import gradio as gr
|
|
|
|
| 2 |
import time # 模拟处理耗时
|
| 3 |
import os
|
| 4 |
import spacy
|
| 5 |
+
from spacy import displacy
|
| 6 |
+
|
| 7 |
os.system("python -m spacy download en_core_web_md")
|
| 8 |
|
| 9 |
nlp = spacy.load("en_core_web_md")
|
| 10 |
+
# def process_api(input_text):
|
| 11 |
+
# # 这里编写实际的后端处理逻辑
|
| 12 |
+
|
| 13 |
+
# return {
|
| 14 |
+
# "status": "success",
|
| 15 |
+
# "result": f"Processed: {input_text.upper()}",
|
| 16 |
+
# "timestamp": time.time()
|
| 17 |
+
# }
|
| 18 |
+
|
| 19 |
+
# # 设置API格式为JSON
|
| 20 |
+
# gr.Interface(
|
| 21 |
+
# fn=process_api,
|
| 22 |
+
# inputs="text",
|
| 23 |
+
# outputs="json",
|
| 24 |
+
# title="Backend API",
|
| 25 |
+
# allow_flagging="never"
|
| 26 |
+
# ).launch()
|
| 27 |
|
| 28 |
|
| 29 |
# import gradio as gr
|