Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -3,8 +3,7 @@
|
|
3 |
import simplestart as ss
|
4 |
import requests
|
5 |
import json
|
6 |
-
import
|
7 |
-
###import mymodule as mm
|
8 |
import psutil
|
9 |
|
10 |
|
@@ -33,12 +32,19 @@ def predict():
|
|
33 |
ss.message(mytext.value)
|
34 |
|
35 |
method = str(ss.session.method)
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
def inference(input_text, method):
|
44 |
#url = "http://0.0.0.0:8106/process" # 假设POST请求的路径是 /process
|
|
|
3 |
import simplestart as ss
|
4 |
import requests
|
5 |
import json
|
6 |
+
import mymodule as mm
|
|
|
7 |
import psutil
|
8 |
|
9 |
|
|
|
32 |
ss.message(mytext.value)
|
33 |
|
34 |
method = str(ss.session.method)
|
35 |
+
|
36 |
+
input = mytext.value[:100].replace("\n", "")
|
37 |
+
|
38 |
+
#本地模式
|
39 |
+
response = mm.predict("'" + input + "'", ss.session.method)
|
40 |
+
res = response.replace("<|endoftext|>", "")
|
41 |
+
|
42 |
+
#服务器模式
|
43 |
+
#response = inference("'" + input + "'", method)
|
44 |
+
#res = response["processed_text"].replace("<|endoftext|>", "")
|
45 |
+
|
46 |
+
myresult.value = res
|
47 |
+
|
48 |
|
49 |
def inference(input_text, method):
|
50 |
#url = "http://0.0.0.0:8106/process" # 假设POST请求的路径是 /process
|