Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -13,7 +13,7 @@ def main():
|
|
13 |
initial_sidebar_state="expanded"
|
14 |
)
|
15 |
|
16 |
-
# Sidebar
|
17 |
(query, num_results, theme, search_clicked, gemini_prompt,
|
18 |
mcp_codegen_prompt, codegen_clicked) = render_sidebar()
|
19 |
|
@@ -35,25 +35,18 @@ def main():
|
|
35 |
answer = gemini_generate(gemini_prompt)
|
36 |
st.success(answer)
|
37 |
|
38 |
-
# -- MCP Code Generation
|
39 |
if mcp_codegen_prompt and codegen_clicked:
|
40 |
st.header("🛠️ Gemini MCP Server Code Generation")
|
41 |
with st.spinner("Gemini is coding your MCP server..."):
|
42 |
-
# You can change the system instruction for advanced results:
|
43 |
system_instruction = (
|
44 |
"You are an expert in Model Context Protocol (MCP) server development. "
|
45 |
-
"Generate clean, production-ready Python code for an MCP server as described
|
46 |
"Use best practices and include all necessary imports and comments."
|
47 |
)
|
48 |
code_result = gemini_generate_code(system_instruction, mcp_codegen_prompt)
|
49 |
st.code(code_result, language="python")
|
50 |
-
# Add download and copy to clipboard
|
51 |
st.download_button("Download code as mcp_server.py", code_result, file_name="mcp_server.py", mime="text/x-python")
|
52 |
-
try:
|
53 |
-
import streamlit_copy_to_clipboard as stc
|
54 |
-
stc.copy_to_clipboard(code_result, "Copy to clipboard")
|
55 |
-
except ImportError:
|
56 |
-
st.info("Install `streamlit-copy-to-clipboard` for copy button.")
|
57 |
|
58 |
# -- Search and Display Papers --
|
59 |
if search_clicked and query:
|
|
|
13 |
initial_sidebar_state="expanded"
|
14 |
)
|
15 |
|
16 |
+
# Sidebar (updated return values)
|
17 |
(query, num_results, theme, search_clicked, gemini_prompt,
|
18 |
mcp_codegen_prompt, codegen_clicked) = render_sidebar()
|
19 |
|
|
|
35 |
answer = gemini_generate(gemini_prompt)
|
36 |
st.success(answer)
|
37 |
|
38 |
+
# -- MCP Code Generation --
|
39 |
if mcp_codegen_prompt and codegen_clicked:
|
40 |
st.header("🛠️ Gemini MCP Server Code Generation")
|
41 |
with st.spinner("Gemini is coding your MCP server..."):
|
|
|
42 |
system_instruction = (
|
43 |
"You are an expert in Model Context Protocol (MCP) server development. "
|
44 |
+
"Generate clean, production-ready Python code for an MCP server as described below. "
|
45 |
"Use best practices and include all necessary imports and comments."
|
46 |
)
|
47 |
code_result = gemini_generate_code(system_instruction, mcp_codegen_prompt)
|
48 |
st.code(code_result, language="python")
|
|
|
49 |
st.download_button("Download code as mcp_server.py", code_result, file_name="mcp_server.py", mime="text/x-python")
|
|
|
|
|
|
|
|
|
|
|
50 |
|
51 |
# -- Search and Display Papers --
|
52 |
if search_clicked and query:
|