Spaces:
Runtime error
Runtime error
Commit
·
192d9af
1
Parent(s):
09e2691
Update app.py
Browse files
app.py
CHANGED
|
@@ -33,11 +33,10 @@ def bot(history):
|
|
| 33 |
history[-1][1] = response
|
| 34 |
return history
|
| 35 |
|
| 36 |
-
|
| 37 |
########## LOADING PRE-COMPUTED EMBEDDINGS ##########
|
| 38 |
class_embeddings = pd.read_csv('Embeddings/MainClassEmbeddings.csv')
|
| 39 |
|
| 40 |
-
|
| 41 |
def classifier(userin, SearchType):
|
| 42 |
clean_in = classification.clean_data(userin, type='String')
|
| 43 |
in_emb = classification.sentence_embedder(clean_in, 'Model_bert')
|
|
@@ -47,7 +46,7 @@ def classifier(userin, SearchType):
|
|
| 47 |
|
| 48 |
return broad_scope_predictions[1], searchlink
|
| 49 |
|
| 50 |
-
|
| 51 |
|
| 52 |
def generateresponse(history):#, task):
|
| 53 |
"""
|
|
@@ -186,7 +185,7 @@ with gr.Blocks(title='Claimed', theme=theme) as demo:
|
|
| 186 |
output = gr.Textbox(label="Output")
|
| 187 |
with gr.Row():
|
| 188 |
classify_btn = gr.Button("Classify")
|
| 189 |
-
|
| 190 |
|
| 191 |
|
| 192 |
gr.Markdown("""
|
|
|
|
| 33 |
history[-1][1] = response
|
| 34 |
return history
|
| 35 |
|
| 36 |
+
|
| 37 |
########## LOADING PRE-COMPUTED EMBEDDINGS ##########
|
| 38 |
class_embeddings = pd.read_csv('Embeddings/MainClassEmbeddings.csv')
|
| 39 |
|
|
|
|
| 40 |
def classifier(userin, SearchType):
|
| 41 |
clean_in = classification.clean_data(userin, type='String')
|
| 42 |
in_emb = classification.sentence_embedder(clean_in, 'Model_bert')
|
|
|
|
| 46 |
|
| 47 |
return broad_scope_predictions[1], searchlink
|
| 48 |
|
| 49 |
+
|
| 50 |
|
| 51 |
def generateresponse(history):#, task):
|
| 52 |
"""
|
|
|
|
| 185 |
output = gr.Textbox(label="Output")
|
| 186 |
with gr.Row():
|
| 187 |
classify_btn = gr.Button("Classify")
|
| 188 |
+
classify_btn.click(fn=classifier, inputs=[userin, SearchType] , outputs=output)
|
| 189 |
|
| 190 |
|
| 191 |
gr.Markdown("""
|