Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,7 +5,7 @@ import requests
|
|
| 5 |
import torch
|
| 6 |
|
| 7 |
# Initialize OpenAI API key
|
| 8 |
-
openai.api_key = "
|
| 9 |
|
| 10 |
# Function to get responses from OpenAI
|
| 11 |
def get_chat_response(query):
|
|
@@ -47,7 +47,7 @@ query = st.text_input("Ask your study-related question:")
|
|
| 47 |
|
| 48 |
if st.button("Get Tips and Resources"):
|
| 49 |
if query:
|
| 50 |
-
# Get response from OpenAI
|
| 51 |
response = get_chat_response(query)
|
| 52 |
if response:
|
| 53 |
st.subheader("OpenAI GPT Response:")
|
|
@@ -68,6 +68,3 @@ if st.button("Get Tips and Resources"):
|
|
| 68 |
# Add a sidebar for additional information
|
| 69 |
st.sidebar.header("About")
|
| 70 |
st.sidebar.text("This is a personalized study assistant chatbot that provides responses from OpenAI GPT and study tips generated locally.")
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
|
|
|
| 5 |
import torch
|
| 6 |
|
| 7 |
# Initialize OpenAI API key
|
| 8 |
+
openai.api_key = "YOUR_OPENAI_API_KEY" # Replace with your actual OpenAI API key
|
| 9 |
|
| 10 |
# Function to get responses from OpenAI
|
| 11 |
def get_chat_response(query):
|
|
|
|
| 47 |
|
| 48 |
if st.button("Get Tips and Resources"):
|
| 49 |
if query:
|
| 50 |
+
# Get response from OpenAI
|
| 51 |
response = get_chat_response(query)
|
| 52 |
if response:
|
| 53 |
st.subheader("OpenAI GPT Response:")
|
|
|
|
| 68 |
# Add a sidebar for additional information
|
| 69 |
st.sidebar.header("About")
|
| 70 |
st.sidebar.text("This is a personalized study assistant chatbot that provides responses from OpenAI GPT and study tips generated locally.")
|
|
|
|
|
|
|
|
|