Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -15,9 +15,9 @@ 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 |
return output['context']
|
23 |
|
@@ -30,9 +30,16 @@ def ask_question_ui(question, context):
|
|
30 |
})
|
31 |
return output2
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
response = requests.post(API_URL2, headers=headers2, json=payload)
|
16 |
return response.json()
|
17 |
|
18 |
+
def inference_ui(question, context):
|
19 |
output = query({
|
20 |
+
"inputs": f"context for '{question}' is: {context}",
|
21 |
})
|
22 |
return output['context']
|
23 |
|
|
|
30 |
})
|
31 |
return output2
|
32 |
|
33 |
+
iface = gr.Interface(
|
34 |
+
fn=ask_question_ui,
|
35 |
+
inputs=[
|
36 |
+
gr.Textbox("Enter your question", key="question"),
|
37 |
+
gr.Textbox("Enter context", key="context"),
|
38 |
+
gr.Button("Ask", key="ask_button"),
|
39 |
+
gr.Button("AutoContext", key="autocontext_button")
|
40 |
+
],
|
41 |
+
outputs=gr.Textbox("Output"),
|
42 |
+
live=True
|
43 |
+
)
|
44 |
+
|
45 |
+
iface.launch()
|