Spaces:
Paused
Paused
Commit
·
98220f7
1
Parent(s):
189f926
Update app.py
Browse files
app.py
CHANGED
|
@@ -31,9 +31,9 @@ generation_config = GenerationConfig(
|
|
| 31 |
# Define a function that takes a text input and generates a text output
|
| 32 |
def generate_text(text):
|
| 33 |
input_text = text
|
| 34 |
-
input_ids = tokenizer.encode(input_text, return_tensors="pt")
|
| 35 |
output_ids = model.generate(input_ids, generation_config=generation_config)
|
| 36 |
-
output_text = tokenizer.decode(output_ids
|
| 37 |
return output_text
|
| 38 |
|
| 39 |
iface = gr.Interface(fn=generate_text, inputs="text", outputs="text")
|
|
|
|
| 31 |
# Define a function that takes a text input and generates a text output
|
| 32 |
def generate_text(text):
|
| 33 |
input_text = text
|
| 34 |
+
input_ids = tokenizer.encode(input_text, return_tensors="pt").to("cuda")
|
| 35 |
output_ids = model.generate(input_ids, generation_config=generation_config)
|
| 36 |
+
output_text = tokenizer.decode(output_ids, skip_special_tokens=True)
|
| 37 |
return output_text
|
| 38 |
|
| 39 |
iface = gr.Interface(fn=generate_text, inputs="text", outputs="text")
|