rootxhacker commited on
Commit
bbc12dc
·
verified ·
1 Parent(s): 1b21c00

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -101,7 +101,16 @@ Provide a detailed review including:
101
 
102
  Start each section with its number and title."""
103
 
104
- return get_completion(few_shot_prompt, model, tokenizer)
 
 
 
 
 
 
 
 
 
105
 
106
  # Create Gradio interface
107
  iface = gr.Interface(
 
101
 
102
  Start each section with its number and title."""
103
 
104
+ full_response = get_completion(few_shot_prompt, model, tokenizer)
105
+
106
+ # Extract only the part of the response after the input code
107
+ start_marker = f"Now, review the following code using the same approach:\n\n{code_to_analyze}\n\n"
108
+ start_index = full_response.find(start_marker)
109
+ if start_index != -1:
110
+ relevant_response = full_response[start_index + len(start_marker):].strip()
111
+ return relevant_response
112
+ else:
113
+ return "Error: Unable to extract the relevant part of the AI's response."
114
 
115
  # Create Gradio interface
116
  iface = gr.Interface(