Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -62,13 +62,11 @@ def translate(
|
|
62 |
|
63 |
prompt = Prompt_template(source_text, source_lang, target_lang)
|
64 |
inputs = tokenizer(prompt, return_tensors="pt")
|
65 |
-
|
66 |
-
input_ids = inputs.to(model.device)
|
67 |
-
|
68 |
streamer = TextIteratorStreamer(tokenizer, **{"skip_special_tokens": True, "skip_prompt": True, 'clean_up_tokenization_spaces':False,})
|
69 |
|
70 |
generate_kwargs = dict(
|
71 |
-
input_ids=
|
72 |
streamer=streamer,
|
73 |
max_length=max_length,
|
74 |
do_sample=True,
|
@@ -134,8 +132,8 @@ with gr.Blocks(theme="soft", css=CSS) as demo:
|
|
134 |
value=0.3,
|
135 |
step=0.1,
|
136 |
)
|
137 |
-
with gr.Column(scale=4):
|
138 |
gr.Markdown(DESCRIPTION)
|
|
|
139 |
source_text = gr.Textbox(
|
140 |
label="Source Text",
|
141 |
value="How we live is so different from how we ought to live that he who studies "+\
|
|
|
62 |
|
63 |
prompt = Prompt_template(source_text, source_lang, target_lang)
|
64 |
inputs = tokenizer(prompt, return_tensors="pt")
|
65 |
+
|
|
|
|
|
66 |
streamer = TextIteratorStreamer(tokenizer, **{"skip_special_tokens": True, "skip_prompt": True, 'clean_up_tokenization_spaces':False,})
|
67 |
|
68 |
generate_kwargs = dict(
|
69 |
+
input_ids=inputs,
|
70 |
streamer=streamer,
|
71 |
max_length=max_length,
|
72 |
do_sample=True,
|
|
|
132 |
value=0.3,
|
133 |
step=0.1,
|
134 |
)
|
|
|
135 |
gr.Markdown(DESCRIPTION)
|
136 |
+
with gr.Column(scale=4):
|
137 |
source_text = gr.Textbox(
|
138 |
label="Source Text",
|
139 |
value="How we live is so different from how we ought to live that he who studies "+\
|