Spaces:
No application file
No application file
Commit ·
b8fb3b9
1
Parent(s): 72fa770
Delete app.py
Browse files
app.py
DELETED
|
@@ -1,33 +0,0 @@
|
|
| 1 |
-
# debugger_app.py
|
| 2 |
-
import streamlit as st
|
| 3 |
-
import openai
|
| 4 |
-
|
| 5 |
-
# Set your OpenAI API key here
|
| 6 |
-
OPENAI_API_KEY = "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"
|
| 7 |
-
openai.api_key = OPENAI_API_KEY
|
| 8 |
-
|
| 9 |
-
def get_chat_response(prompt):
|
| 10 |
-
response = openai.Completion.create(
|
| 11 |
-
engine="text-davinci-002",
|
| 12 |
-
prompt=prompt,
|
| 13 |
-
max_tokens=150,
|
| 14 |
-
stop=None,
|
| 15 |
-
temperature=0.7,
|
| 16 |
-
)
|
| 17 |
-
return response.choices[0].text.strip()
|
| 18 |
-
|
| 19 |
-
def main():
|
| 20 |
-
st.title("Code Debugger and Error Solver from FULL STACK ACADEMY")
|
| 21 |
-
|
| 22 |
-
code = st.text_area("Enter your Python code with an error:")
|
| 23 |
-
error = st.text_area("Enter the error message:")
|
| 24 |
-
|
| 25 |
-
if st.button("Debug"):
|
| 26 |
-
# Preprocess the inputs to create a prompt for ChatGPT
|
| 27 |
-
prompt = f"You are an helpful technical assistant so give me an solution for this Code:\n\n{code}\n\n which has error in it and this is the Error Message: {error}"
|
| 28 |
-
response = get_chat_response(prompt)
|
| 29 |
-
st.write("The following must be an possible solution: ")
|
| 30 |
-
st.code(response)
|
| 31 |
-
|
| 32 |
-
if __name__ == "__main__":
|
| 33 |
-
main()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|