Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -15,17 +15,17 @@ 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": output
|
26 |
},
|
27 |
})
|
28 |
return output2
|
29 |
|
30 |
-
iface = gr.Interface(fn=inference_ui, inputs="text", outputs="text")
|
31 |
iface.launch()
|
|
|
15 |
response = requests.post(API_URL2, headers=headers2, json=payload)
|
16 |
return response.json()
|
17 |
|
18 |
+
def inference_ui(question, context_input):
|
19 |
output = query({
|
20 |
+
"inputs": f"context for '{question}' is: {context_input}",
|
21 |
})
|
22 |
output2 = query2({
|
23 |
"inputs": {
|
24 |
"question": question,
|
25 |
+
"context": output['context'] # Ensure that 'context' is a string
|
26 |
},
|
27 |
})
|
28 |
return output2
|
29 |
|
30 |
+
iface = gr.Interface(fn=inference_ui, inputs=["text", "text"], outputs="text")
|
31 |
iface.launch()
|