Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,17 @@
|
|
|
|
1 |
from transformers import pipeline
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
# Load the zero-shot classification pipeline
|
4 |
classifier = pipeline('zero-shot-classification', model='facebook/bart-large-mnli')
|
5 |
|
@@ -15,11 +27,11 @@ def classify_term(term):
|
|
15 |
# Classify all terms
|
16 |
df['classification'] = df['term'].apply(classify_term)
|
17 |
|
18 |
-
#
|
19 |
-
# Example: Assume subdisciplines are known and mapped to disciplines
|
20 |
subdiscipline_to_discipline = {
|
21 |
'Atmospheric Chemistry': 'Atmospheric Science',
|
22 |
'Organic Chemistry': 'Chemistry',
|
|
|
23 |
# Add your mappings here
|
24 |
}
|
25 |
|
|
|
1 |
+
import pandas as pd
|
2 |
from transformers import pipeline
|
3 |
|
4 |
+
# Example data
|
5 |
+
data = {
|
6 |
+
'term': [
|
7 |
+
'Atmospheric Chemistry',
|
8 |
+
'Organic Chemistry',
|
9 |
+
'Business Ethics',
|
10 |
+
'Corporate Social Responsibility'
|
11 |
+
]
|
12 |
+
}
|
13 |
+
df = pd.DataFrame(data)
|
14 |
+
|
15 |
# Load the zero-shot classification pipeline
|
16 |
classifier = pipeline('zero-shot-classification', model='facebook/bart-large-mnli')
|
17 |
|
|
|
27 |
# Classify all terms
|
28 |
df['classification'] = df['term'].apply(classify_term)
|
29 |
|
30 |
+
# Example mapping of subdisciplines to disciplines
|
|
|
31 |
subdiscipline_to_discipline = {
|
32 |
'Atmospheric Chemistry': 'Atmospheric Science',
|
33 |
'Organic Chemistry': 'Chemistry',
|
34 |
+
'Corporate Social Responsibility': 'Business Ethics'
|
35 |
# Add your mappings here
|
36 |
}
|
37 |
|