Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -122,7 +122,7 @@ with gr.Blocks(theme=gr.themes.Soft(), title="🤖 AI Code Copilot") as demo:
|
|
| 122 |
output_text = gr.Markdown()
|
| 123 |
# Display suggestions
|
| 124 |
gr.Markdown("**Suggestions:**")
|
| 125 |
-
|
| 126 |
# Display pattern analysis
|
| 127 |
gr.Markdown("**Pattern Analysis:**")
|
| 128 |
pattern_display = gr.Dataframe(
|
|
@@ -133,7 +133,7 @@ with gr.Blocks(theme=gr.themes.Soft(), title="🤖 AI Code Copilot") as demo:
|
|
| 133 |
)
|
| 134 |
|
| 135 |
# Processing function for both button and enter
|
| 136 |
-
def
|
| 137 |
response, patterns, sugg = copilot.process_input(user_input)
|
| 138 |
pattern_df = pd.DataFrame({
|
| 139 |
"Pattern": list(patterns.keys()),
|
|
@@ -142,14 +142,14 @@ with gr.Blocks(theme=gr.themes.Soft(), title="🤖 AI Code Copilot") as demo:
|
|
| 142 |
return response, sugg, pattern_df
|
| 143 |
|
| 144 |
submit_btn.click(
|
| 145 |
-
fn=
|
| 146 |
inputs=input_text,
|
| 147 |
-
outputs=[output_text,
|
| 148 |
)
|
| 149 |
input_text.submit(
|
| 150 |
-
fn=
|
| 151 |
inputs=input_text,
|
| 152 |
-
outputs=[output_text,
|
| 153 |
)
|
| 154 |
|
| 155 |
if __name__ == "__main__":
|
|
|
|
| 122 |
output_text = gr.Markdown()
|
| 123 |
# Display suggestions
|
| 124 |
gr.Markdown("**Suggestions:**")
|
| 125 |
+
suggestions_output = gr.Markdown()
|
| 126 |
# Display pattern analysis
|
| 127 |
gr.Markdown("**Pattern Analysis:**")
|
| 128 |
pattern_display = gr.Dataframe(
|
|
|
|
| 133 |
)
|
| 134 |
|
| 135 |
# Processing function for both button and enter
|
| 136 |
+
def process_input_wrapper(user_input):
|
| 137 |
response, patterns, sugg = copilot.process_input(user_input)
|
| 138 |
pattern_df = pd.DataFrame({
|
| 139 |
"Pattern": list(patterns.keys()),
|
|
|
|
| 142 |
return response, sugg, pattern_df
|
| 143 |
|
| 144 |
submit_btn.click(
|
| 145 |
+
fn=process_input_wrapper,
|
| 146 |
inputs=input_text,
|
| 147 |
+
outputs=[output_text, suggestions_output, pattern_display]
|
| 148 |
)
|
| 149 |
input_text.submit(
|
| 150 |
+
fn=process_input_wrapper,
|
| 151 |
inputs=input_text,
|
| 152 |
+
outputs=[output_text, suggestions_output, pattern_display]
|
| 153 |
)
|
| 154 |
|
| 155 |
if __name__ == "__main__":
|