Spaces:
Sleeping
Sleeping
RandomNameAnd6
commited on
Commit
•
b8e19cc
1
Parent(s):
9550700
Update app.py
Browse files
app.py
CHANGED
@@ -11,7 +11,7 @@ model = GPT2LMHeadModel.from_pretrained("RandomNameAnd6/DharGPT-Small")
|
|
11 |
|
12 |
def generate_text(prompt):
|
13 |
input_ids = tokenizer.encode(prompt, return_tensors="pt")
|
14 |
-
output = model.generate(input_ids, max_length=
|
15 |
text = tokenizer.decode(output[0], skip_special_tokens=True)
|
16 |
return text
|
17 |
|
@@ -21,7 +21,7 @@ with open('dhar_mann_titles.txt', 'r') as file:
|
|
21 |
|
22 |
# Function to generate an AI title (dummy implementation)
|
23 |
def generate_ai_title():
|
24 |
-
inputs = tokenizer(["<|startoftext|>"]*1, return_tensors = "pt")
|
25 |
outputs = model.generate(**inputs, max_new_tokens=50, use_cache=True, temperature=0.85, do_sample=True)
|
26 |
return (tokenizer.batch_decode(outputs)[0])[15:]
|
27 |
|
|
|
11 |
|
12 |
def generate_text(prompt):
|
13 |
input_ids = tokenizer.encode(prompt, return_tensors="pt")
|
14 |
+
output = model.generate(input_ids, max_length=48, temperature=0.85, do_sample=True)
|
15 |
text = tokenizer.decode(output[0], skip_special_tokens=True)
|
16 |
return text
|
17 |
|
|
|
21 |
|
22 |
# Function to generate an AI title (dummy implementation)
|
23 |
def generate_ai_title():
|
24 |
+
inputs = tokenizer(["<|startoftext|>"]*1, return_tensors = "pt")
|
25 |
outputs = model.generate(**inputs, max_new_tokens=50, use_cache=True, temperature=0.85, do_sample=True)
|
26 |
return (tokenizer.batch_decode(outputs)[0])[15:]
|
27 |
|