Spaces:
Runtime error
Runtime error
Armandoliv
commited on
Commit
•
d319358
1
Parent(s):
c828564
Update app.py
Browse files
app.py
CHANGED
@@ -9,7 +9,7 @@ device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
|
9 |
model = model.to(device)
|
10 |
|
11 |
def main_generator(text):
|
12 |
-
|
13 |
preprocess_text = text.strip().replace("\n"," ").strip()
|
14 |
prompt = f"<|startoftext|> {preprocess_text}"
|
15 |
generated = torch.tensor(tokenizer.encode(prompt)).unsqueeze(0)
|
@@ -37,8 +37,9 @@ inputs = [gr.Textbox(lines=1, placeholder="Text Here...", label="Input")]
|
|
37 |
outputs = gr.Text( label="10 Tweets Generated")
|
38 |
title="Tweets generation app"
|
39 |
description = "This demo uses AI Models to create tweets.\nIt focus on Data Science and Machine Learning tweets creation."
|
|
|
40 |
|
41 |
-
io = gr.Interface(fn=main_generator, inputs=inputs, outputs=outputs, title=title, description = description,
|
42 |
|
43 |
css= """.gr-button-primary { background: -webkit-linear-gradient(
|
44 |
90deg, #355764 0%, #55a8a1 100% ) !important; background: #355764;
|
|
|
9 |
model = model.to(device)
|
10 |
|
11 |
def main_generator(text):
|
12 |
+
|
13 |
preprocess_text = text.strip().replace("\n"," ").strip()
|
14 |
prompt = f"<|startoftext|> {preprocess_text}"
|
15 |
generated = torch.tensor(tokenizer.encode(prompt)).unsqueeze(0)
|
|
|
37 |
outputs = gr.Text( label="10 Tweets Generated")
|
38 |
title="Tweets generation app"
|
39 |
description = "This demo uses AI Models to create tweets.\nIt focus on Data Science and Machine Learning tweets creation."
|
40 |
+
examples = ['I wonder']
|
41 |
|
42 |
+
io = gr.Interface(fn=main_generator, inputs=inputs, outputs=outputs, title=title, description = description, examples = examples,
|
43 |
|
44 |
css= """.gr-button-primary { background: -webkit-linear-gradient(
|
45 |
90deg, #355764 0%, #55a8a1 100% ) !important; background: #355764;
|