abdullah040 commited on
Commit
475dfcc
·
1 Parent(s): dc35ce2

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -0
app.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from gpt_index import GPTSimpleVectorIndex
3
+
4
+ index = GPTSimpleVectorIndex.load_from_disk('/index(4).json')
5
+
6
+ def my_model_function(input_text):
7
+ response = index.query(input_text, response_mode="compact")
8
+ return response
9
+
10
+ iface = gr.Interface(
11
+ fn=my_model_function,
12
+ inputs=gr.inputs.Textbox(label="Enter your question here"),
13
+ outputs="text",
14
+ title="GPT Index Demo",
15
+ description="Type a question and see the matching responses from the index!"
16
+ )
17
+
18
+ iface.launch()