Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -15,17 +15,25 @@ def query2(payload):
|
|
15 |
response = requests.post(API_URL2, headers=headers2, json=payload)
|
16 |
return response.json()
|
17 |
|
18 |
-
def inference_ui(question
|
19 |
output = query({
|
20 |
-
"inputs": f"context for '{question}' is:
|
21 |
})
|
|
|
|
|
|
|
|
|
|
|
22 |
output2 = query2({
|
23 |
"inputs": {
|
24 |
"question": question,
|
25 |
-
"context":
|
26 |
},
|
27 |
})
|
28 |
return output2
|
29 |
|
30 |
-
|
31 |
-
|
|
|
|
|
|
|
|
15 |
response = requests.post(API_URL2, headers=headers2, json=payload)
|
16 |
return response.json()
|
17 |
|
18 |
+
def inference_ui(question):
|
19 |
output = query({
|
20 |
+
"inputs": f"context for '{question}' is:",
|
21 |
})
|
22 |
+
return output['context']
|
23 |
+
|
24 |
+
def ask_question_ui():
|
25 |
+
question = gr.textbox("Enter your question:")
|
26 |
+
context = gr.textbox("Enter context:")
|
27 |
output2 = query2({
|
28 |
"inputs": {
|
29 |
"question": question,
|
30 |
+
"context": context
|
31 |
},
|
32 |
})
|
33 |
return output2
|
34 |
|
35 |
+
iface_context = gr.Interface(fn=inference_ui, inputs="text", outputs="text", live=True)
|
36 |
+
iface_ask_question = gr.Interface(fn=ask_question_ui, inputs=["text", "text"], outputs="text", live=True)
|
37 |
+
|
38 |
+
iface_context.launch(share=True)
|
39 |
+
iface_ask_question.launch(share=True)
|