Spaces:
Running
Running
imperialwool
commited on
Commit
•
7b90833
1
Parent(s):
2a6bb6a
Update app.py
Browse files
app.py
CHANGED
@@ -11,7 +11,7 @@ from transformers import AutoTokenizer, AutoModelForSequenceClassification, Auto
|
|
11 |
|
12 |
#initing
|
13 |
app = Flask(__name__)
|
14 |
-
VERSION = '1.0
|
15 |
app.config['JSON_AS_ASCII'] = False
|
16 |
limiter = Limiter(app=app, key_func=get_remote_address, default_limits=["5/minute"], storage_uri="memory://",)
|
17 |
|
@@ -150,7 +150,10 @@ def chitchatRu():
|
|
150 |
return {"status": "error", "details": {"error_code": 101, "error_details": "No text provided"}}, 400
|
151 |
|
152 |
inputs = chct_t.encode(text, padding=True, truncation=True, return_tensors="pt")
|
153 |
-
generated_ids = chct_m.generate(
|
|
|
|
|
|
|
154 |
answer = chct_t.decode(generated_ids[0], skip_special_tokens=True)
|
155 |
return {"status": "pass", "answer": answer}, 200
|
156 |
except Exception as e:
|
|
|
11 |
|
12 |
#initing
|
13 |
app = Flask(__name__)
|
14 |
+
VERSION = '1.0 build117'
|
15 |
app.config['JSON_AS_ASCII'] = False
|
16 |
limiter = Limiter(app=app, key_func=get_remote_address, default_limits=["5/minute"], storage_uri="memory://",)
|
17 |
|
|
|
150 |
return {"status": "error", "details": {"error_code": 101, "error_details": "No text provided"}}, 400
|
151 |
|
152 |
inputs = chct_t.encode(text, padding=True, truncation=True, return_tensors="pt")
|
153 |
+
generated_ids = chct_m.generate(
|
154 |
+
input_ids=inputs,
|
155 |
+
use_cache=False
|
156 |
+
)
|
157 |
answer = chct_t.decode(generated_ids[0], skip_special_tokens=True)
|
158 |
return {"status": "pass", "answer": answer}, 200
|
159 |
except Exception as e:
|