Spaces:
Runtime error
Runtime error
Commit ·
55c50f0
1
Parent(s): 078e9fd
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
import os
|
| 2 |
import openai
|
| 3 |
import gradio as gr
|
| 4 |
-
import
|
| 5 |
|
| 6 |
# Set the OpenAI API key
|
| 7 |
os.environ["OPENAI_API_KEY"] = "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"
|
|
@@ -10,7 +10,7 @@ os.environ["OPENAI_API_KEY"] = "sk-n7lgQD2BtmLVSoR25SS5T3BlbkFJ5Iy7LL853I9vfwzFp
|
|
| 10 |
embeddings = openai.OpenAIEmbeddings(model="text-embedding-ada-002")
|
| 11 |
|
| 12 |
# Create a Chroma database
|
| 13 |
-
database =
|
| 14 |
|
| 15 |
# Function to create embeddings from a text document
|
| 16 |
def create_embeddings(text):
|
|
@@ -40,7 +40,7 @@ def create_chatbot():
|
|
| 40 |
|
| 41 |
# Generate a response using the GPT-3.5 Turbo model
|
| 42 |
response = openai.Completion.create(
|
| 43 |
-
engine="davinci-
|
| 44 |
prompt="Generate a response to the query: " + document["text"],
|
| 45 |
max_tokens=100,
|
| 46 |
)
|
|
|
|
| 1 |
import os
|
| 2 |
import openai
|
| 3 |
import gradio as gr
|
| 4 |
+
import chromadb
|
| 5 |
|
| 6 |
# Set the OpenAI API key
|
| 7 |
os.environ["OPENAI_API_KEY"] = "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"
|
|
|
|
| 10 |
embeddings = openai.OpenAIEmbeddings(model="text-embedding-ada-002")
|
| 11 |
|
| 12 |
# Create a Chroma database
|
| 13 |
+
database = chromadb.Database("database.db")
|
| 14 |
|
| 15 |
# Function to create embeddings from a text document
|
| 16 |
def create_embeddings(text):
|
|
|
|
| 40 |
|
| 41 |
# Generate a response using the GPT-3.5 Turbo model
|
| 42 |
response = openai.Completion.create(
|
| 43 |
+
engine="text-davinci-003",
|
| 44 |
prompt="Generate a response to the query: " + document["text"],
|
| 45 |
max_tokens=100,
|
| 46 |
)
|