Update README.md
Browse files
README.md
CHANGED
@@ -10,4 +10,34 @@ The first model for automatic text-to-video prompt generation. It finetuned on [
|
|
10 |
|
11 |
# Usage
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
# Demo
|
|
|
10 |
|
11 |
# Usage
|
12 |
|
13 |
+
## Download the model
|
14 |
+
```
|
15 |
+
from transformers import pipeline
|
16 |
+
pipe = pipeline("text-generation", model="WenhaoWang/AutoT2VPrompt")
|
17 |
+
```
|
18 |
+
|
19 |
+
## Set the Parameters
|
20 |
+
```
|
21 |
+
input = "An undemwater world"
|
22 |
+
max_length = 50
|
23 |
+
temperature = 1.2
|
24 |
+
top_k = 8
|
25 |
+
num_return_sequences = 10
|
26 |
+
```
|
27 |
+
|
28 |
+
## Generation
|
29 |
+
```
|
30 |
+
all_prompts = pipe(input, max_length = max_length, do_sample = True, temperature = temperature, top_k = top_k, num_return_sequences=num_return_sequences)
|
31 |
+
|
32 |
+
def process(text):
|
33 |
+
text = text.replace('\n', '.')
|
34 |
+
text = text.replace(' .', '.')
|
35 |
+
text = text[:text.rfind('.')]
|
36 |
+
text = text + '.'
|
37 |
+
return text
|
38 |
+
|
39 |
+
for i in range(len(num_return_sequences)):
|
40 |
+
print(all_prompts[i]['generated_text'])
|
41 |
+
```
|
42 |
+
|
43 |
# Demo
|