Spaces:
Runtime error
Runtime error
Danil
commited on
Commit
β’
abe5a52
1
Parent(s):
5f59db3
app.py
CHANGED
@@ -35,7 +35,7 @@ repetition_penalty = st.slider('repetition_penalty', 1.0, 10.0, 1.0)
|
|
35 |
|
36 |
if gen:
|
37 |
c.code('Generating...')
|
38 |
-
req = f"http://0.0.0.0:8080?input_text={txt}&top_p={
|
39 |
res = requests.get(req)
|
40 |
print('ok')
|
41 |
c.code(json.loads(res.text))
|
|
|
35 |
|
36 |
if gen:
|
37 |
c.code('Generating...')
|
38 |
+
req = f"http://0.0.0.0:8080?input_text={txt}&top_p={top_p}&top_k={top_k}&temperature={temperature}&num_beams={num_beams}&repetition_penalty={repetition_penalty}&max_length={max_length}"
|
39 |
res = requests.get(req)
|
40 |
print('ok')
|
41 |
c.code(json.loads(res.text))
|
server.py
CHANGED
@@ -12,6 +12,6 @@ print('load ok')
|
|
12 |
@app.get("/")
|
13 |
def read_root(input_text, max_length, top_p, top_k, num_beams, temperature, repetition_penalty):
|
14 |
inpt = tokenizer.encode(input_text, return_tensors="pt")
|
15 |
-
out = model.generate(inpt, max_length=max_length, top_p=float(top_p)
|
16 |
res = tokenizer.decode(out[0])
|
17 |
return {res}
|
|
|
12 |
@app.get("/")
|
13 |
def read_root(input_text, max_length, top_p, top_k, num_beams, temperature, repetition_penalty):
|
14 |
inpt = tokenizer.encode(input_text, return_tensors="pt")
|
15 |
+
out = model.generate(inpt, max_length=int(max_length), top_p=float(top_p), top_k=float(top_k), temperature=float(temperature), num_beams=int(num_beams), repetition_penalty=float(repetition_penalty))
|
16 |
res = tokenizer.decode(out[0])
|
17 |
return {res}
|