Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -8,7 +8,8 @@ API_URL2 = "https://api-inference.huggingface.co/models/valhalla/longformer-base
|
|
8 |
headers2 = {"Authorization": "Bearer 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"}
|
9 |
|
10 |
def query(payload):
|
11 |
-
|
|
|
12 |
return response.json()["answer"]
|
13 |
|
14 |
def query2(question, context): # Accept two arguments
|
@@ -23,6 +24,13 @@ iface = gr.Interface(
|
|
23 |
title="AI Interface",
|
24 |
description="Ask the AI model anything!",
|
25 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
iface.launch()
|
28 |
|
|
|
8 |
headers2 = {"Authorization": "Bearer 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"}
|
9 |
|
10 |
def query(payload):
|
11 |
+
payload2 = "whats the context of teh question " + paylaod + " :"
|
12 |
+
response = requests.post(API_URL, headers=headers, json=payload2)
|
13 |
return response.json()["answer"]
|
14 |
|
15 |
def query2(question, context): # Accept two arguments
|
|
|
24 |
title="AI Interface",
|
25 |
description="Ask the AI model anything!",
|
26 |
)
|
27 |
+
iface2 = gr.Interface(
|
28 |
+
fn=query,
|
29 |
+
inputs=[gr.Textbox("question")],
|
30 |
+
outputs=gr.Textbox("answer"),
|
31 |
+
title="AI Interface",
|
32 |
+
description="Ask the AI model anything!",
|
33 |
+
)
|
34 |
|
35 |
iface.launch()
|
36 |
|