Alaaeldin commited on
Commit
c7b3623
·
verified ·
1 Parent(s): 676e871

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -1,13 +1,14 @@
1
  from transformers import pipeline
2
 
3
  # Initialize the text generation pipeline with the distilgpt2 model
4
- generator = pipeline('text-generation', model='distilgpt2')
 
5
 
6
  # Generate text with the specified parameters
7
  output = generator(
8
  'in this course, we will teach how to',
9
  max_length=20, # Set maximum length of the generated text
10
- num_return_sequences=4 # Generate 2 sequences
11
  )
12
 
13
  # Print the full output
 
1
  from transformers import pipeline
2
 
3
  # Initialize the text generation pipeline with the distilgpt2 model
4
+ generator = pipeline('text-generation', model='distilgpt2', device=0) # Use GPU (device 0)
5
+
6
 
7
  # Generate text with the specified parameters
8
  output = generator(
9
  'in this course, we will teach how to',
10
  max_length=20, # Set maximum length of the generated text
11
+ num_return_sequences=1 # Generate 2 sequences
12
  )
13
 
14
  # Print the full output