Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -45,16 +45,18 @@ if upload_code_file is not None:
|
|
45 |
code_image = Image.open(upload_code_file)
|
46 |
st.image(code_image, caption="Uploaded Code Image", use_column_width=True)
|
47 |
|
48 |
-
# Prompt Template for code interpretation
|
49 |
-
input_prompt_code = """
|
50 |
-
You are an expert in coding. The image contains a piece of code. Your task is to interpret the code and solve the problem it presents.
|
51 |
-
Provide
|
52 |
-
"""
|
53 |
-
|
54 |
-
# Button for code interpretation
|
55 |
-
submit = st.button("Interpret Code!")
|
56 |
-
if submit:
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
|
|
|
|
|
45 |
code_image = Image.open(upload_code_file)
|
46 |
st.image(code_image, caption="Uploaded Code Image", use_column_width=True)
|
47 |
|
48 |
+
# Prompt Template for code interpretation
|
49 |
+
input_prompt_code = """
|
50 |
+
You are an expert in coding. The image contains a piece of code. Your task is to interpret the code and solve the problem it presents.
|
51 |
+
Provide a complete solution of the code.
|
52 |
+
"""
|
53 |
+
|
54 |
+
# Button for code interpretation
|
55 |
+
submit = st.button("Interpret Code!")
|
56 |
+
if submit:
|
57 |
+
code_image_data = prep_image(upload_code_file)
|
58 |
+
response = get_response_code(code_image_data, input_prompt_code)
|
59 |
+
st.subheader("Code AI: ")
|
60 |
+
st.write(response)
|
61 |
+
else:
|
62 |
+
st.info("Please upload an image of the code to proceed.")
|