Spaces:
Runtime error
Runtime error
abhisheky127
commited on
Commit
•
8ae1757
1
Parent(s):
e0beecd
Update app.py
Browse files
app.py
CHANGED
@@ -6,9 +6,9 @@ access_token = os.environ["access_token"]
|
|
6 |
|
7 |
title = "NX Block Trade: Multilingual Zero Shot News Classification"
|
8 |
description = "powered by xlm-roberta-large-xnli made by @abhisheky127"
|
9 |
-
classifier = pipeline("zero-shot-classification",
|
10 |
-
|
11 |
-
|
12 |
|
13 |
categories = ['sports',
|
14 |
'IPL_2023',
|
@@ -84,42 +84,42 @@ test_examples = [
|
|
84 |
]
|
85 |
|
86 |
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
|
91 |
-
#define a function to process your input and output
|
92 |
-
def zero_shot(doc, candidates):
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
|
101 |
|
102 |
|
103 |
-
#create input and output objects
|
104 |
-
#input object1
|
105 |
-
input1 = gr.Textbox(label="Text")
|
106 |
|
107 |
-
#input object 2
|
108 |
-
input2 = gr.Textbox(label="Labels")
|
109 |
|
110 |
|
111 |
-
#output object
|
112 |
-
output = gr.Label(label="Output")
|
113 |
|
114 |
|
115 |
-
#create interface
|
116 |
-
gui = gr.Interface(title=title,
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
|
124 |
-
#display the interface
|
125 |
-
gui.launch(debug=True)
|
|
|
6 |
|
7 |
title = "NX Block Trade: Multilingual Zero Shot News Classification"
|
8 |
description = "powered by xlm-roberta-large-xnli made by @abhisheky127"
|
9 |
+
# classifier = pipeline("zero-shot-classification",
|
10 |
+
# model="joeddav/xlm-roberta-large-xnli",
|
11 |
+
# token=access_token)
|
12 |
|
13 |
categories = ['sports',
|
14 |
'IPL_2023',
|
|
|
84 |
]
|
85 |
|
86 |
|
87 |
+
gr.Interface.load(model="models/joeddav/xlm-roberta-large-xnli", use_auth_token=access_token,
|
88 |
+
title=title, description=description,
|
89 |
+
examples=examples_).launch()
|
90 |
|
91 |
+
# #define a function to process your input and output
|
92 |
+
# def zero_shot(doc, candidates):
|
93 |
+
# given_labels = candidates.split(",")
|
94 |
+
# given_labels = list(map(str.strip, given_labels))
|
95 |
+
# print(doc)
|
96 |
+
# dictionary = classifier(doc, given_labels)
|
97 |
+
# labels = dictionary['labels']
|
98 |
+
# scores = dictionary['scores']
|
99 |
+
# return dict(zip(labels, scores))
|
100 |
|
101 |
|
102 |
|
103 |
+
# #create input and output objects
|
104 |
+
# #input object1
|
105 |
+
# input1 = gr.Textbox(label="Text")
|
106 |
|
107 |
+
# #input object 2
|
108 |
+
# input2 = gr.Textbox(label="Labels")
|
109 |
|
110 |
|
111 |
+
# #output object
|
112 |
+
# output = gr.Label(label="Output")
|
113 |
|
114 |
|
115 |
+
# #create interface
|
116 |
+
# gui = gr.Interface(title=title,
|
117 |
+
# description=description,
|
118 |
+
# fn=zero_shot,
|
119 |
+
# inputs=[input1, input2],
|
120 |
+
# outputs=[output],
|
121 |
+
# examples=test_examples
|
122 |
+
# )
|
123 |
|
124 |
+
# #display the interface
|
125 |
+
# gui.launch(debug=True)
|