Spaces:
Running
Running
Shunfeng Zheng
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -7,23 +7,23 @@ from spacy import displacy
|
|
7 |
os.system("python -m spacy download en_core_web_md")
|
8 |
|
9 |
nlp = spacy.load("en_core_web_md")
|
10 |
-
|
11 |
-
#
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
#
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
|
28 |
|
29 |
# import gradio as gr
|
|
|
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
|