Spaces:
Runtime error
Runtime error
from gpt_index import SimpleDirectoryReader, GPTListIndex, GPTSimpleVectorIndex, LLMPredictor, PromptHelper | |
from langchain.chat_models import ChatOpenAI | |
import gradio as gr | |
import sys | |
import os | |
os.environ["OPENAI_API_KEY"] = os.getenv("OPENAI_API_KEY") | |
def chatbot(input_text): | |
index = GPTSimpleVectorIndex.load_from_disk('index.json') | |
prompt = "Your task is to select top 3 most compatible roles based of the list of the roles from the documents for the person with following skills and appearance: " + input_text + ". Provide the results in JSON format and explain your choice for each selection in separate field for each JSON record" | |
response = index.query(prompt) | |
return response.response | |
iface = gr.Interface(fn=chatbot, | |
inputs=gr.components.Textbox(lines=5, label="Desribe the actor's skills and appearance", show_copy_button=True), | |
outputs=gr.components.Textbox(lines=5, label="Most compatible roles", show_copy_button=True), | |
title="UnCut Assistant") | |
iface.launch() |