Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -54,9 +54,10 @@ def translate(
|
|
| 54 |
source_text: str,
|
| 55 |
source_lang: str,
|
| 56 |
target_lang: str,
|
| 57 |
-
max_chunk: int,
|
| 58 |
max_length: int,
|
| 59 |
-
temperature: float
|
|
|
|
|
|
|
| 60 |
|
| 61 |
print(f'Text is - {source_text}')
|
| 62 |
|
|
@@ -107,7 +108,7 @@ with gr.Blocks(theme="soft", css=CSS) as demo:
|
|
| 107 |
value="Spanish",
|
| 108 |
)
|
| 109 |
max_length = gr.Slider(
|
| 110 |
-
label="
|
| 111 |
minimum=512,
|
| 112 |
maximum=8192,
|
| 113 |
value=4096,
|
|
@@ -120,6 +121,20 @@ with gr.Blocks(theme="soft", css=CSS) as demo:
|
|
| 120 |
value=0.3,
|
| 121 |
step=0.1,
|
| 122 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
gr.Markdown(DESCRIPTION)
|
| 124 |
with gr.Column(scale=4):
|
| 125 |
source_text = gr.Textbox(
|
|
@@ -138,7 +153,7 @@ with gr.Blocks(theme="soft", css=CSS) as demo:
|
|
| 138 |
clear = gr.ClearButton([source_text, output_text])
|
| 139 |
|
| 140 |
source_text.change(lang_detector, source_text, source_lang)
|
| 141 |
-
submit.click(fn=translate, inputs=[source_text, source_lang, target_lang,
|
| 142 |
|
| 143 |
|
| 144 |
if __name__ == "__main__":
|
|
|
|
| 54 |
source_text: str,
|
| 55 |
source_lang: str,
|
| 56 |
target_lang: str,
|
|
|
|
| 57 |
max_length: int,
|
| 58 |
+
temperature: float,
|
| 59 |
+
top_p: float,
|
| 60 |
+
rp: float):
|
| 61 |
|
| 62 |
print(f'Text is - {source_text}')
|
| 63 |
|
|
|
|
| 108 |
value="Spanish",
|
| 109 |
)
|
| 110 |
max_length = gr.Slider(
|
| 111 |
+
label="Max Length",
|
| 112 |
minimum=512,
|
| 113 |
maximum=8192,
|
| 114 |
value=4096,
|
|
|
|
| 121 |
value=0.3,
|
| 122 |
step=0.1,
|
| 123 |
)
|
| 124 |
+
top_p = gr.Slider(
|
| 125 |
+
minimum=0.0,
|
| 126 |
+
maximum=1.0,
|
| 127 |
+
step=0.1,
|
| 128 |
+
value=1.0,
|
| 129 |
+
label="top_p",
|
| 130 |
+
)
|
| 131 |
+
rp = gr.Slider(
|
| 132 |
+
minimum=0.0,
|
| 133 |
+
maximum=2.0,
|
| 134 |
+
step=0.1,
|
| 135 |
+
value=1.2,
|
| 136 |
+
label="Repetition penalty",
|
| 137 |
+
)
|
| 138 |
gr.Markdown(DESCRIPTION)
|
| 139 |
with gr.Column(scale=4):
|
| 140 |
source_text = gr.Textbox(
|
|
|
|
| 153 |
clear = gr.ClearButton([source_text, output_text])
|
| 154 |
|
| 155 |
source_text.change(lang_detector, source_text, source_lang)
|
| 156 |
+
submit.click(fn=translate, inputs=[source_text, source_lang, target_lang, max_length, temperature, top_p, rp], outputs=[output_text])
|
| 157 |
|
| 158 |
|
| 159 |
if __name__ == "__main__":
|