naman1102 commited on
Commit
e5959c0
·
1 Parent(s): bd91ae0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +45 -18
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.Markdown("## Repo ID Input")
122
- repo_id_box = repo_id_input.render()
123
- df_box = df_output.render()
124
- submit_btn = gr.Button("Submit Repo IDs")
125
- submit_btn.click(process_repo_input_and_store, inputs=repo_id_box, outputs=df_box)
 
 
 
 
 
 
126
 
127
- gr.Markdown("---")
128
- gr.Markdown("## Keyword Search for Repos")
129
- keyword_input = gr.Textbox(label="Enter keyword to search repos", lines=1, placeholder="e.g. audio")
130
- keyword_btn = gr.Button("Search and Update Repo List")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
  keyword_btn.click(keyword_search_and_update, inputs=keyword_input, outputs=df_box)
 
132
 
133
- gr.Markdown("---")
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()