Update app.py
Browse files
app.py
CHANGED
@@ -114,30 +114,57 @@ def show_combined_repo_and_llm():
|
|
114 |
summary = f"{extraction_status}\n\nStrengths:\n{strengths}\n\nWeaknesses:\n{weaknesses}"
|
115 |
return combined_content, summary, df
|
116 |
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
repo_id_input = gr.Textbox(label="Enter repo IDs (comma or newline separated)", lines=5, placeholder="repo1, repo2\nrepo3")
|
118 |
-
df_output = gr.Dataframe(headers=["repo id", "strength", "weaknesses", "speciality", "relevance rating", "Usecase"]
|
|
|
|
|
|
|
|
|
|
|
119 |
|
120 |
with gr.Blocks() as demo:
|
121 |
-
gr.
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
|
127 |
-
|
128 |
-
gr.
|
129 |
-
|
130 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
keyword_btn.click(keyword_search_and_update, inputs=keyword_input, outputs=df_box)
|
|
|
132 |
|
133 |
-
|
134 |
-
gr.Markdown("## Combine and Display Repo Files")
|
135 |
-
combine_btn = gr.Button("Download, Combine & Show .py/.md Files from Next Repo and Analyze")
|
136 |
-
combined_txt = gr.Textbox(label="Combined Repo Files", lines=20)
|
137 |
-
llm_output_txt = gr.Textbox(label="LLM Analysis Output", lines=10)
|
138 |
-
df_display = gr.Dataframe(
|
139 |
-
headers=["repo id", "strength", "weaknesses", "speciality", "relevance rating", "Usecase"]
|
140 |
-
)
|
141 |
combine_btn.click(show_combined_repo_and_llm, inputs=None, outputs=[combined_txt, llm_output_txt, df_display])
|
142 |
|
143 |
demo.launch()
|
|
|
114 |
summary = f"{extraction_status}\n\nStrengths:\n{strengths}\n\nWeaknesses:\n{weaknesses}"
|
115 |
return combined_content, summary, df
|
116 |
|
117 |
+
def go_to_analysis():
|
118 |
+
return gr.update(visible=False), gr.update(visible=True)
|
119 |
+
|
120 |
+
def go_to_input():
|
121 |
+
return gr.update(visible=True), gr.update(visible=False)
|
122 |
+
|
123 |
repo_id_input = gr.Textbox(label="Enter repo IDs (comma or newline separated)", lines=5, placeholder="repo1, repo2\nrepo3")
|
124 |
+
df_output = gr.Dataframe(headers=["repo id", "strength", "weaknesses", "speciality", "relevance rating", "Usecase"],
|
125 |
+
datatype=["str", "str", "str", "str", "str", "str"],
|
126 |
+
max_rows=10,
|
127 |
+
max_cols=6,
|
128 |
+
wrap=True
|
129 |
+
)
|
130 |
|
131 |
with gr.Blocks() as demo:
|
132 |
+
page_state = gr.State(0)
|
133 |
+
|
134 |
+
# --- Page 1: Input ---
|
135 |
+
with gr.Column(visible=True) as input_page:
|
136 |
+
gr.Markdown("## Enter Keyword or Repo IDs")
|
137 |
+
keyword_input = gr.Textbox(label="Enter keyword to search repos", lines=1, placeholder="e.g. audio")
|
138 |
+
keyword_btn = gr.Button("Search and Update Repo List")
|
139 |
+
repo_id_box = repo_id_input.render()
|
140 |
+
df_box = df_output.render()
|
141 |
+
submit_btn = gr.Button("Submit Repo IDs")
|
142 |
+
next_btn = gr.Button("Next: Go to Analysis")
|
143 |
|
144 |
+
# --- Page 2: Analysis ---
|
145 |
+
with gr.Column(visible=False) as analysis_page:
|
146 |
+
gr.Markdown("## Combine and Display Repo Files")
|
147 |
+
combine_btn = gr.Button("Download, Combine & Show .py/.md Files from Next Repo and Analyze")
|
148 |
+
combined_txt = gr.Textbox(label="Combined Repo Files", lines=20)
|
149 |
+
llm_output_txt = gr.Textbox(label="LLM Analysis Output", lines=10)
|
150 |
+
df_display = gr.Dataframe(
|
151 |
+
headers=["repo id", "strength", "weaknesses", "speciality", "relevance rating", "Usecase"],
|
152 |
+
datatype=["str", "str", "str", "str", "str", "str"],
|
153 |
+
max_rows=10,
|
154 |
+
max_cols=6,
|
155 |
+
wrap=True
|
156 |
+
)
|
157 |
+
back_btn = gr.Button("Back to Input")
|
158 |
+
|
159 |
+
# Button logic to switch pages
|
160 |
+
next_btn.click(go_to_analysis, inputs=None, outputs=[input_page, analysis_page])
|
161 |
+
back_btn.click(go_to_input, inputs=None, outputs=[input_page, analysis_page])
|
162 |
+
|
163 |
+
# Keyword and repo input logic
|
164 |
keyword_btn.click(keyword_search_and_update, inputs=keyword_input, outputs=df_box)
|
165 |
+
submit_btn.click(process_repo_input_and_store, inputs=repo_id_box, outputs=df_box)
|
166 |
|
167 |
+
# Analysis logic
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
combine_btn.click(show_combined_repo_and_llm, inputs=None, outputs=[combined_txt, llm_output_txt, df_display])
|
169 |
|
170 |
demo.launch()
|