Southampton-GPT / app.py
Warlord-K's picture
Change fn index
84f69f2
raw
history blame
818 Bytes
from gradio_client import Client
import gradio as gr
chat_client = Client("https://mosaicml-mpt-30b-chat.hf.space/", serialize = False)
retrieval = Client("https://slycat-southampton-similarity.hf.space/")
chatbot = [["", None]]
info="Information: \n"
q_prompt="\n ##Instruction: Please provide an appropriate response to the following in less than 3 lines: \n"
def main(question):
global chatbot
information = retrieval.predict(question, api_name = "/predict")
answer=chat_client.predict(
info +information+question, # str in 'Type an input and press Enter' Textbox component
chatbot,
fn_index=1
)
chatbot = answer[1]
return answer[1][0][1]
demo = gr.Interface(main,"text","text")
if __name__ == "__main__":
demo.launch()