Spaces:
Runtime error
Runtime error
Commit
·
86f4489
1
Parent(s):
6a14450
Update app.py
Browse files
app.py
CHANGED
@@ -13,16 +13,9 @@ model = PeftModel.from_pretrained(model, "mohamedemam/Arabic-meeting-summarizati
|
|
13 |
model_name ="bigscience/bloomz-3b"
|
14 |
tokenizer = AutoTokenizer.from_pretrained("bigscience/bloomz-3b")
|
15 |
model.eval()
|
16 |
-
import wikipediaapi
|
17 |
|
18 |
|
19 |
# Create a Wikipedia API instance
|
20 |
-
wiki_wiki = wikipediaapi.Wikipedia('MyProjectName ([email protected])', 'en')
|
21 |
-
page_py = wiki_wiki.page('Leo messi')
|
22 |
-
example_contexts=page_py.text.split(f"\n")
|
23 |
-
for i in range(len(example_contexts)):
|
24 |
-
example_contexts[i]=re.sub(f'\n'," ", example_contexts[i])
|
25 |
-
# Recommended words for users to choose from
|
26 |
|
27 |
|
28 |
# Function to generate questions and answers with configurable parameters
|
@@ -31,8 +24,7 @@ def generate_qa(context, temperature, top_p,num_seq,l_p, num_b):
|
|
31 |
input_ids = tokenizer(text=input_text, return_tensors='pt')
|
32 |
|
33 |
# Generate with configurable parameters
|
34 |
-
output = model.generate(
|
35 |
-
**input_ids,
|
36 |
temperature=temperature,
|
37 |
top_p=top_p,
|
38 |
num_return_sequences=num_seq,
|
|
|
13 |
model_name ="bigscience/bloomz-3b"
|
14 |
tokenizer = AutoTokenizer.from_pretrained("bigscience/bloomz-3b")
|
15 |
model.eval()
|
|
|
16 |
|
17 |
|
18 |
# Create a Wikipedia API instance
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
|
21 |
# Function to generate questions and answers with configurable parameters
|
|
|
24 |
input_ids = tokenizer(text=input_text, return_tensors='pt')
|
25 |
|
26 |
# Generate with configurable parameters
|
27 |
+
output = model.generate(**input_ids,
|
|
|
28 |
temperature=temperature,
|
29 |
top_p=top_p,
|
30 |
num_return_sequences=num_seq,
|