Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,8 +4,8 @@ import requests
|
|
| 4 |
headers = {"Authorization": f"Bearer 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"}
|
| 5 |
#API_URL = "https://api-inference.huggingface.co/models/facebook/bart-large-mnli"
|
| 6 |
#API_URL = "https://api-inference.huggingface.co/models/microsoft/DialoGPT-large"
|
| 7 |
-
|
| 8 |
-
API_URL = "https://api-inference.huggingface.co/models/bert-large-uncased-whole-word-masking-finetuned-squad"
|
| 9 |
|
| 10 |
|
| 11 |
def query(payload):
|
|
@@ -25,9 +25,13 @@ def query(payload):
|
|
| 25 |
#"context": "My name is Clara and I live in Berkeley."
|
| 26 |
},
|
| 27 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
-
|
| 30 |
-
response = requests.request("POST", API_URL, headers=headers, data=json.dumps(data))
|
| 31 |
response_txt = json.loads(response.content.decode("utf-8"))
|
| 32 |
print(response_txt)
|
| 33 |
return response_txt
|
|
|
|
| 4 |
headers = {"Authorization": f"Bearer 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"}
|
| 5 |
#API_URL = "https://api-inference.huggingface.co/models/facebook/bart-large-mnli"
|
| 6 |
#API_URL = "https://api-inference.huggingface.co/models/microsoft/DialoGPT-large"
|
| 7 |
+
API_URL = "https://api-inference.huggingface.co/models/deepset/roberta-base-squad2"
|
| 8 |
+
#API_URL = "https://api-inference.huggingface.co/models/bert-large-uncased-whole-word-masking-finetuned-squad"
|
| 9 |
|
| 10 |
|
| 11 |
def query(payload):
|
|
|
|
| 25 |
#"context": "My name is Clara and I live in Berkeley."
|
| 26 |
},
|
| 27 |
}
|
| 28 |
+
|
| 29 |
+
QA_input = {
|
| 30 |
+
'question': 'Why is model conversion important?',
|
| 31 |
+
'context': 'The option to convert models between FARM and transformers gives freedom to the user and let people easily switch between frameworks.'
|
| 32 |
+
}
|
| 33 |
|
| 34 |
+
response = requests.request("POST", API_URL, headers=headers, data=json.dumps(QA_input))
|
|
|
|
| 35 |
response_txt = json.loads(response.content.decode("utf-8"))
|
| 36 |
print(response_txt)
|
| 37 |
return response_txt
|