File size: 1,128 Bytes
478e016
 
 
 
 
 
 
05d3d0d
 
478e016
 
 
05d3d0d
478e016
 
 
 
 
c6287f2
 
 
 
478e016
05d3d0d
478e016
 
c6287f2
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from gpt_index import Document, SimpleDirectoryReader, GPTListIndex, GPTSimpleVectorIndex, LLMPredictor, PromptHelper
from langchain import OpenAI
import openai
import gradio as gr
import sys
import os


def chatbot(indexName, input_text):
    """
    Chatbot function that takes in a prompt and returns a response
    """
    index = GPTSimpleVectorIndex.load_from_disk(indexName+'.json')
    response = index.query(input_text, response_mode="compact")
    return response.response


iface = gr.Interface(fn=chatbot,
                     inputs= [ 
                         gr.Dropdown(["RetroFeedback", "WizFeedback", "Passwordless"], 
                                     type="value", value="RetroFeedback", label="Select Pulse Data"), 
                         gr.Textbox(lines=7, label="Ask any question", placeholder='What is the summary?')],
                     outputs="text",
                     title="NLP Demo for Chat Interface")


iface.launch(auth=('axiamatic', os.environ['LOGIN_PASS']), 
             auth_message='For access, please check my Slack profile or contact me in Slack.', 
             share=False)