Spaces:
Runtime error
Runtime error
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] | |
example_questions = [ | |
"What is University of Southampton?", | |
"Is University of Southampton Good?", | |
"What is sports facility at southampton university?", | |
"How big is the Southampton campus?", | |
"What are the rankings of southampton university?", | |
"What research facilities does the Southampton university offer ?", | |
] | |
demo = gr.Interface( | |
fn=main, | |
inputs="text", | |
outputs="text", | |
examples=example_questions, | |
) | |
if __name__ == "__main__": | |
demo.launch() |