Spaces:
Sleeping
Sleeping
mohamedemam
commited on
Commit
•
af3b18b
1
Parent(s):
696c2a6
Update app.py
Browse files
app.py
CHANGED
@@ -8,15 +8,12 @@ model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
|
|
8 |
|
9 |
# Function to generate questions and answers with configurable parameters
|
10 |
def generate_qa(context, temperature, top_p):
|
11 |
-
input_text = f"
|
12 |
input_ids = ttokenizer(input_text,max_length=400,truncation=True,padding="max_length",return_tensors='pt')
|
13 |
|
14 |
# Generate with configurable parameters
|
15 |
output = model.generate(
|
16 |
-
input_ids,
|
17 |
-
max_length=150,
|
18 |
-
num_return_sequences=1,
|
19 |
-
no_repeat_ngram_size=2,
|
20 |
temperature=temperature,
|
21 |
top_p=top_p
|
22 |
)
|
|
|
8 |
|
9 |
# Function to generate questions and answers with configurable parameters
|
10 |
def generate_qa(context, temperature, top_p):
|
11 |
+
input_text = f"what: {context}"
|
12 |
input_ids = ttokenizer(input_text,max_length=400,truncation=True,padding="max_length",return_tensors='pt')
|
13 |
|
14 |
# Generate with configurable parameters
|
15 |
output = model.generate(
|
16 |
+
**input_ids,
|
|
|
|
|
|
|
17 |
temperature=temperature,
|
18 |
top_p=top_p
|
19 |
)
|