Upload app.py
Browse files
app.py
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from llama_index import StorageContext, load_index_from_storage
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
def chatbot(zask="Where is Florida?"):
|
5 |
+
storage_context = StorageContext.from_defaults(persist_dir='Meta_Index\FloridaSutLaws')
|
6 |
+
index = load_index_from_storage(storage_context)
|
7 |
+
query_engine = index.as_query_engine()
|
8 |
+
response = query_engine.query(zask)
|
9 |
+
return response
|
10 |
+
|
11 |
+
iface = gr.Interface(fn=chatbot,
|
12 |
+
inputs=gr.components.Textbox(lines=7, label="Input Text"),
|
13 |
+
outputs=gr.components.Textbox(lines=7, label="Output Text"),
|
14 |
+
title="Chatbot regarding Florida Sales & Use Tax Statutes and Codes")
|
15 |
+
|
16 |
+
iface.launch(share=True)
|
17 |
+
|