Update app.py
Browse files
app.py
CHANGED
|
@@ -19,7 +19,7 @@ def vipe_generate(text, model, tokenizer,device,do_sample,top_k=100, epsilon_cut
|
|
| 19 |
#return only the generated prompts
|
| 20 |
pred_caps = tokenizer.batch_decode(generated_ids[:, -(generated_ids.shape[1] - input_ids.shape[1]):], skip_special_tokens=True)
|
| 21 |
|
| 22 |
-
return pred_caps
|
| 23 |
|
| 24 |
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
| 25 |
model = GPT2LMHeadModel.from_pretrained('fittar/ViPE-M-CTX7')
|
|
@@ -40,7 +40,7 @@ examples = [
|
|
| 40 |
|
| 41 |
title = "ViPE: Visualize Pretty-much Everything"
|
| 42 |
description = 'ViPE is the first automated model for translating any arbitrary piece of text into a visualizable prompt. It helps any text-to-image model in figurative or non-lexical language visualizations. To learn more about the model, [click here](https://huggingface.co/fittar/ViPE-M-CTX7).<br>'
|
| 43 |
-
txt = gr.Textbox(lines=1, label="
|
| 44 |
out = gr.Textbox(lines=4, label="Generated Prompt for Visualizations")
|
| 45 |
|
| 46 |
demo = gr.Interface(
|
|
|
|
| 19 |
#return only the generated prompts
|
| 20 |
pred_caps = tokenizer.batch_decode(generated_ids[:, -(generated_ids.shape[1] - input_ids.shape[1]):], skip_special_tokens=True)
|
| 21 |
|
| 22 |
+
return pred_caps[0]
|
| 23 |
|
| 24 |
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
| 25 |
model = GPT2LMHeadModel.from_pretrained('fittar/ViPE-M-CTX7')
|
|
|
|
| 40 |
|
| 41 |
title = "ViPE: Visualize Pretty-much Everything"
|
| 42 |
description = 'ViPE is the first automated model for translating any arbitrary piece of text into a visualizable prompt. It helps any text-to-image model in figurative or non-lexical language visualizations. To learn more about the model, [click here](https://huggingface.co/fittar/ViPE-M-CTX7).<br>'
|
| 43 |
+
txt = gr.Textbox(lines=1, label="Arbitrary Input Text", placeholder="Initial text")
|
| 44 |
out = gr.Textbox(lines=4, label="Generated Prompt for Visualizations")
|
| 45 |
|
| 46 |
demo = gr.Interface(
|