Spaces:
Runtime error
Runtime error
Fix
Browse files
app.py
CHANGED
|
@@ -12,7 +12,7 @@ pipe = pipeline(task='text2text-generation', model=model, tokenizer=tokenizer)
|
|
| 12 |
|
| 13 |
def paraphrase(text, num_outputs, n_beams, min_len, max_len):
|
| 14 |
# for j in range(3):
|
| 15 |
-
out = pipe(text, num_return_sequences=num_outputs, encoder_no_repeat_ngram_size=4, do_sample=True, num_beams=n_beams, max_length=max_len)
|
| 16 |
return out
|
| 17 |
|
| 18 |
text = st.text_area('متن محاورهای خود را در این کادر وارد نمائید:', "من با دوستام میرم بازی", height=50)
|
|
@@ -26,8 +26,8 @@ with st.spinner("در حال تبدیل متن..."):
|
|
| 26 |
if button and text:
|
| 27 |
out = paraphrase(text,num_outputs, num_beams, min_length, max_length)
|
| 28 |
st.markdown("**متن خروجی:**")
|
| 29 |
-
for i in out:
|
| 30 |
-
st.write(out)
|
| 31 |
|
| 32 |
# x = st.slider('Select a value')
|
| 33 |
# st.write(x, 'squared is', x * x)
|
|
|
|
| 12 |
|
| 13 |
def paraphrase(text, num_outputs, n_beams, min_len, max_len):
|
| 14 |
# for j in range(3):
|
| 15 |
+
out = pipe(text, num_return_sequences=num_outputs, encoder_no_repeat_ngram_size=4, do_sample=True, num_beams=n_beams, max_length=max_len)
|
| 16 |
return out
|
| 17 |
|
| 18 |
text = st.text_area('متن محاورهای خود را در این کادر وارد نمائید:', "من با دوستام میرم بازی", height=50)
|
|
|
|
| 26 |
if button and text:
|
| 27 |
out = paraphrase(text,num_outputs, num_beams, min_length, max_length)
|
| 28 |
st.markdown("**متن خروجی:**")
|
| 29 |
+
for i, txt in enumerate(out):
|
| 30 |
+
st.write(out[i]['generated_text'])
|
| 31 |
|
| 32 |
# x = st.slider('Select a value')
|
| 33 |
# st.write(x, 'squared is', x * x)
|