Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
|
|
3 |
|
4 |
description = """
|
5 |
When in legal doubt, you better call BLOOM! Ask BLOOM any legal question:
|
@@ -10,7 +11,11 @@ examples = [["Adventurer is approached by a mysterious stranger in the tavern fo
|
|
10 |
|
11 |
|
12 |
|
13 |
-
|
|
|
|
|
|
|
|
|
14 |
|
15 |
def preprocess(text):
|
16 |
#We add 'Question :' and 'Answer #1:' at the start and end of the prompt
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
+
from transformers import BloomTokenizerFast, BloomForCausalLM
|
4 |
|
5 |
description = """
|
6 |
When in legal doubt, you better call BLOOM! Ask BLOOM any legal question:
|
|
|
11 |
|
12 |
|
13 |
|
14 |
+
tokenizer = BloomTokenizerFast.from_pretrained("tomrb/bettercallbloom-3b-8bit")
|
15 |
+
model = BloomForCausalLM.from_pretrained("tomrb/bettercallbloom-3b-8bit")
|
16 |
+
|
17 |
+
generator = pipeline('text-generation', model=model, tokenizer=tokenizer)
|
18 |
+
|
19 |
|
20 |
def preprocess(text):
|
21 |
#We add 'Question :' and 'Answer #1:' at the start and end of the prompt
|