Shunfeng Zheng commited on
Commit
c9c01b7
·
verified ·
1 Parent(s): 22920e8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -17
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
- return {
12
- "status": "success",
13
- "result": f"Processed: {input_text.upper()}",
14
- "timestamp": time.time()
15
- }
16
-
17
- # 设置API格式为JSON
18
- gr.Interface(
19
- fn=process_api,
20
- inputs="text",
21
- outputs="json",
22
- title="Backend API",
23
- allow_flagging="never"
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