Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -7,7 +7,7 @@ headers = {"Authorization": "Bearer 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"}
|
|
7 |
def query(payload):
|
8 |
response = requests.post(API_URL, headers=headers, json=payload)
|
9 |
return response.json()
|
10 |
-
|
11 |
API_URL2 = "https://api-inference.huggingface.co/models/valhalla/longformer-base-4096-finetuned-squadv1"
|
12 |
headers2 = {"Authorization": "Bearer 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"}
|
13 |
|
@@ -15,20 +15,11 @@ def query2(payload):
|
|
15 |
response = requests.post(API_URL2, headers=headers2, json=payload)
|
16 |
return response.json()
|
17 |
|
18 |
-
class State:
|
19 |
-
question = ""
|
20 |
-
context = ""
|
21 |
-
answer = ""
|
22 |
-
|
23 |
-
state = State()
|
24 |
-
|
25 |
def ask_question(question, context):
|
26 |
-
state.question = question
|
27 |
-
state.context = context
|
28 |
output2 = query2({
|
29 |
"inputs": {
|
30 |
-
"question":
|
31 |
-
"context":
|
32 |
},
|
33 |
})
|
34 |
ask_question.interface.outputs[0].value = output2 # Update the value of the answer Textbox
|
|
|
7 |
def query(payload):
|
8 |
response = requests.post(API_URL, headers=headers, json=payload)
|
9 |
return response.json()
|
10 |
+
|
11 |
API_URL2 = "https://api-inference.huggingface.co/models/valhalla/longformer-base-4096-finetuned-squadv1"
|
12 |
headers2 = {"Authorization": "Bearer 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"}
|
13 |
|
|
|
15 |
response = requests.post(API_URL2, headers=headers2, json=payload)
|
16 |
return response.json()
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
def ask_question(question, context):
|
|
|
|
|
19 |
output2 = query2({
|
20 |
"inputs": {
|
21 |
+
"question": question,
|
22 |
+
"context": context
|
23 |
},
|
24 |
})
|
25 |
ask_question.interface.outputs[0].value = output2 # Update the value of the answer Textbox
|