Spaces:
Runtime error
Runtime error
Commit
·
906763f
1
Parent(s):
b56fd2b
Update app.py
Browse files
app.py
CHANGED
@@ -30,41 +30,10 @@ def bot(history):
|
|
30 |
history[-1][1] = response
|
31 |
return history
|
32 |
|
33 |
-
"""
|
34 |
-
|
35 |
-
Place holder alpaca model trained example:
|
36 |
-
Required:
|
37 |
-
!pip install -q datasets loralib sentencepiece
|
38 |
-
!pip install -q git+https://github.com/zphang/transformers@c3dc391
|
39 |
-
!pip install bitsandbytes
|
40 |
-
|
41 |
-
"""
|
42 |
-
|
43 |
-
'''
|
44 |
-
|
45 |
-
tokenizer = LLaMATokenizer.from_pretrained("chavinlo/alpaca-native")
|
46 |
-
|
47 |
-
model = LLaMAForCausalLM.from_pretrained(
|
48 |
-
"chavinlo/alpaca-native",
|
49 |
-
load_in_8bit=True,
|
50 |
-
device_map="auto",
|
51 |
-
)
|
52 |
-
'''
|
53 |
|
54 |
########## LOADING PRE-COMPUTED EMBEDDINGS ##########
|
55 |
class_embeddings = pd.read_csv('Embeddings/MainClassEmbeddings.csv')
|
56 |
|
57 |
-
"""
|
58 |
-
abstract = """
|
59 |
-
#Described herein are strength characteristics and biodegradation of articles produced using one or more “green” sustainable polymers and one or more carbohydrate-based polymers. A compatibilizer can optionally be included in the article. In some cases, the article can include a film, a bag, a bottle, a cap or lid therefore, a sheet, a box or other container, a plate, a cup, utensils, or the like.
|
60 |
-
"""
|
61 |
-
abstract= classification.clean_data(abstract, type='String')
|
62 |
-
abstract_embedding = classification.sentence_embedder(abstract, 'Model_bert')
|
63 |
-
Number = 10
|
64 |
-
broad_scope_predictions = classification.broad_scope_class_predictor(class_embeddings, abstract_embedding, Number, Sensitivity='High')
|
65 |
-
|
66 |
-
print(broad_scope_class_predictor)
|
67 |
-
"""
|
68 |
|
69 |
def classifier(userin):
|
70 |
clean_in = classification.clean_data(userin, type='String')
|
|
|
30 |
history[-1][1] = response
|
31 |
return history
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
########## LOADING PRE-COMPUTED EMBEDDINGS ##########
|
35 |
class_embeddings = pd.read_csv('Embeddings/MainClassEmbeddings.csv')
|
36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
def classifier(userin):
|
39 |
clean_in = classification.clean_data(userin, type='String')
|