Spaces:
Runtime error
Runtime error
Update
Browse files
app.py
CHANGED
@@ -10,16 +10,16 @@ model = AutoModel.from_pretrained(model_path)
|
|
10 |
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
11 |
pipe = pipeline(task='text2text-generation', model=model, tokenizer=tokenizer)
|
12 |
|
13 |
-
def paraphrase(text):
|
14 |
for j in range(3):
|
15 |
-
out = pipe(text, encoder_no_repeat_ngram_size=4, do_sample=True, num_beams=
|
16 |
print("Paraphrase:", out)
|
17 |
|
18 |
-
|
|
|
19 |
min_length = st.sidebar.slider('حداقل طول جمله', min_value=10, max_value=100, value=50, step=10)
|
20 |
max_length = st.sidebar.slider('حداکثر طول طول جمله', min_value=30, max_value=700, value=100, step=10)
|
21 |
-
|
22 |
-
out = paraphrase(link)
|
23 |
st.write(out)
|
24 |
# x = st.slider('Select a value')
|
25 |
# st.write(x, 'squared is', x * x)
|
|
|
10 |
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
11 |
pipe = pipeline(task='text2text-generation', model=model, tokenizer=tokenizer)
|
12 |
|
13 |
+
def paraphrase(text, min_len, max_len=128, n_beams=5):
|
14 |
for j in range(3):
|
15 |
+
out = pipe(text, encoder_no_repeat_ngram_size=4, do_sample=True, num_beams=n_beams, max_length=max_len)[0]['generated_text']
|
16 |
print("Paraphrase:", out)
|
17 |
|
18 |
+
text = st.text_area('Paste your link here...', "من با دوستام میرم بازی", height=50)
|
19 |
+
num_beams = st.sidebar.slider('طول Beam', min_value=1, max_value=10, value=5, step=1)
|
20 |
min_length = st.sidebar.slider('حداقل طول جمله', min_value=10, max_value=100, value=50, step=10)
|
21 |
max_length = st.sidebar.slider('حداکثر طول طول جمله', min_value=30, max_value=700, value=100, step=10)
|
22 |
+
out = paraphrase(text, num_beams, min_length, max_length)
|
|
|
23 |
st.write(out)
|
24 |
# x = st.slider('Select a value')
|
25 |
# st.write(x, 'squared is', x * x)
|