Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,15 +1,18 @@
|
|
1 |
import gradio as gr
|
2 |
import requests
|
3 |
|
4 |
-
|
5 |
API_URL = "https://api-inference.huggingface.co/models/tiiuae/falcon-7b-instruct"
|
6 |
headers = {"Authorization": "Bearer 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"}
|
|
|
7 |
API_URL2 = "https://api-inference.huggingface.co/models/valhalla/longformer-base-4096-finetuned-squadv1"
|
8 |
headers2 = {"Authorization": "Bearer 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"}
|
|
|
9 |
def query(payload):
|
10 |
response = requests.post(API_URL, headers=headers, json=payload)
|
11 |
return response.json()
|
12 |
-
|
|
|
|
|
13 |
response = requests.post(API_URL2, headers=headers2, json=payload)
|
14 |
return response.json()
|
15 |
|
@@ -22,3 +25,4 @@ iface = gr.Interface(
|
|
22 |
)
|
23 |
|
24 |
iface.launch()
|
|
|
|
1 |
import gradio as gr
|
2 |
import requests
|
3 |
|
|
|
4 |
API_URL = "https://api-inference.huggingface.co/models/tiiuae/falcon-7b-instruct"
|
5 |
headers = {"Authorization": "Bearer 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"}
|
6 |
+
|
7 |
API_URL2 = "https://api-inference.huggingface.co/models/valhalla/longformer-base-4096-finetuned-squadv1"
|
8 |
headers2 = {"Authorization": "Bearer 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"}
|
9 |
+
|
10 |
def query(payload):
|
11 |
response = requests.post(API_URL, headers=headers, json=payload)
|
12 |
return response.json()
|
13 |
+
|
14 |
+
def query2(question, context): # Accept two arguments
|
15 |
+
payload = {"question": question, "context": context}
|
16 |
response = requests.post(API_URL2, headers=headers2, json=payload)
|
17 |
return response.json()
|
18 |
|
|
|
25 |
)
|
26 |
|
27 |
iface.launch()
|
28 |
+
|