Spaces:
Sleeping
Sleeping
File size: 781 Bytes
137ca1e de170a6 358293d 137ca1e de170a6 99505b0 137ca1e 710fa58 7c59f10 710fa58 511ef29 358293d 137ca1e 069da75 137ca1e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
import gradio
import os
from llama_index import SimpleDirectoryReader, GPTListIndex, readers, GPTSimpleVectorIndex, LLMPredictor, PromptHelper, ServiceContext
#openai.api_key = "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"
#os.environ["OPENAI_API_KEY"] = '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'
os.environ["OPENAI_API_KEY"] = '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'
def gradio_ask_ai(user_input):
index = GPTSimpleVectorIndex.load_from_disk('index.json')
query = user_input
f=open("yo.txt","w")
f.write("file created")
f.close()
response = index.query(query)
return response.response
demo = gradio.Interface(fn=gradio_ask_ai, inputs = "text", outputs = "text", title = "Meshworks bot")
demo.launch(inline=False) |