wop commited on
Commit
2613527
1 Parent(s): 1487649

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -8
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
- iface_context = gr.Interface(fn=inference_ui, inputs="text", outputs="text", live=True)
34
- iface_ask_question = gr.Interface(fn=ask_question_ui, inputs=["text", "text"], outputs="text", live=True)
35
-
36
- iface_context.launch(share=True)
37
- iface_ask_question.launch(share=True)
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()