Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import openai
|
| 2 |
+
import gradio as gr
|
| 3 |
+
from pinecone import Pinecone
|
| 4 |
+
|
| 5 |
+
pc = Pinecone(api_key=api_key)
|
| 6 |
+
pinecone_index = pc.Index("si")
|
| 7 |
+
query_engine = index.as_query_engine()
|
| 8 |
+
|
| 9 |
+
def predict(message, history):
|
| 10 |
+
query_engine = index.as_query_engine()
|
| 11 |
+
streaming_response = query_engine.query(message)
|
| 12 |
+
return str(streaming_response)
|
| 13 |
+
|
| 14 |
+
history = []
|
| 15 |
+
gr.ChatInterface(predict).launch()
|