rootxhacker commited on
Commit
f722dc4
1 Parent(s): 2cf6bfb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -109,15 +109,21 @@ Start each section with its number and title."""
109
  response_start += len(code_to_analyze)
110
  ai_response = full_response[response_start:].strip()
111
 
112
- # Remove any leading text before the first numbered section
113
- first_section = ai_response.find("1.")
114
- if first_section != -1:
115
- ai_response = ai_response[first_section:]
 
 
 
 
 
116
 
117
  return ai_response
118
  else:
119
  return "Error: Unable to extract the AI's response. Here's the full output:\n\n" + full_response
120
 
 
121
  # Create Gradio interface
122
  iface = gr.Interface(
123
  fn=code_review,
 
109
  response_start += len(code_to_analyze)
110
  ai_response = full_response[response_start:].strip()
111
 
112
+ # Find the second occurrence of "1. Understanding of the code"
113
+ first_occurrence = ai_response.find("1. Understanding of the code")
114
+ if first_occurrence != -1:
115
+ second_occurrence = ai_response.find("1. Understanding of the code", first_occurrence + 1)
116
+ if second_occurrence != -1:
117
+ ai_response = ai_response[second_occurrence:]
118
+ else:
119
+ # If we can't find a second occurrence, start from the first one
120
+ ai_response = ai_response[first_occurrence:]
121
 
122
  return ai_response
123
  else:
124
  return "Error: Unable to extract the AI's response. Here's the full output:\n\n" + full_response
125
 
126
+
127
  # Create Gradio interface
128
  iface = gr.Interface(
129
  fn=code_review,