Update app.py
Browse files
app.py
CHANGED
|
@@ -828,7 +828,7 @@ def _mem_save(
|
|
| 828 |
4. Operation is protected by an in‑process reentrant lock only (no cross‑process locking).
|
| 829 |
|
| 830 |
Returns:
|
| 831 |
-
str: Human readable confirmation containing the new memory UUID (full or prefix
|
| 832 |
|
| 833 |
Security / Privacy:
|
| 834 |
Data is plaintext JSON on local disk; do NOT store secrets or regulated data.
|
|
@@ -1004,7 +1004,7 @@ concise_interface = gr.Interface(
|
|
| 1004 |
outputs=gr.Textbox(label="Search Results", interactive=False),
|
| 1005 |
title="DuckDuckGo Search",
|
| 1006 |
description=(
|
| 1007 |
-
"<div style=\"text-align:center\">
|
| 1008 |
),
|
| 1009 |
api_description=(
|
| 1010 |
"Run a DuckDuckGo search and return numbered results with URLs, titles, and summaries. "
|
|
@@ -1057,7 +1057,7 @@ CSS_STYLES = """
|
|
| 1057 |
}
|
| 1058 |
.gradio-container h1::after {
|
| 1059 |
grid-row: 3;
|
| 1060 |
-
content: "Authentication is optional but Image/Video Generation require a `HF_READ_TOKEN` in env secrets. They are hidden otherwise. Same with Memory (intended for local)";
|
| 1061 |
display: block;
|
| 1062 |
font-size: 1rem;
|
| 1063 |
font-weight: 400;
|
|
@@ -1090,7 +1090,7 @@ kokoro_interface = gr.Interface(
|
|
| 1090 |
outputs=gr.Audio(label="Audio", type="numpy", format="wav", show_download_button=True),
|
| 1091 |
title="Kokoro TTS",
|
| 1092 |
description=(
|
| 1093 |
-
"<div style=\"text-align:center\">Generate speech with Kokoro-82M
|
| 1094 |
),
|
| 1095 |
api_description=(
|
| 1096 |
"Synthesize speech from text using Kokoro-82M TTS model. Returns (sample_rate, waveform) suitable for playback. "
|
|
@@ -1102,14 +1102,14 @@ kokoro_interface = gr.Interface(
|
|
| 1102 |
flagging_mode="never",
|
| 1103 |
)
|
| 1104 |
|
| 1105 |
-
def
|
| 1106 |
action: Annotated[Literal["save","list","search","delete"], "Action to perform: save | list | search | delete"],
|
| 1107 |
-
text: Annotated[Optional[str], "Text content (
|
| 1108 |
-
tags: Annotated[Optional[str], "Comma-separated tags (
|
| 1109 |
-
query: Annotated[Optional[str], "Search query terms (
|
| 1110 |
-
limit: Annotated[int, "Max results
|
| 1111 |
-
memory_id: Annotated[Optional[str], "Full UUID or unique prefix (
|
| 1112 |
-
include_tags: Annotated[bool, "Include tags
|
| 1113 |
) -> str:
|
| 1114 |
"""Manage lightweight local JSON “memories” (save | list | search | delete) in one MCP tool.
|
| 1115 |
|
|
@@ -1183,7 +1183,7 @@ def Memory_Tool(
|
|
| 1183 |
return "Error: invalid action (use save|list|search|delete)."
|
| 1184 |
|
| 1185 |
memory_interface = gr.Interface(
|
| 1186 |
-
fn=
|
| 1187 |
inputs=[
|
| 1188 |
gr.Dropdown(label="Action", choices=["save","list","search","delete"], value="list"),
|
| 1189 |
gr.Textbox(label="Text", lines=3, placeholder="Memory text (save)"),
|
|
@@ -1196,11 +1196,12 @@ memory_interface = gr.Interface(
|
|
| 1196 |
outputs=gr.Textbox(label="Result", lines=14),
|
| 1197 |
title="Memory Manager",
|
| 1198 |
description=(
|
| 1199 |
-
"Lightweight local JSON memory store (no external DB). Choose an Action, fill only the relevant fields, and run
|
| 1200 |
),
|
| 1201 |
api_description=(
|
| 1202 |
"Manage short text memories with optional tags. Actions: save(text,tags), list(limit,include_tags), "
|
| 1203 |
-
"search(query,limit,include_tags), delete(memory_id).
|
|
|
|
| 1204 |
),
|
| 1205 |
flagging_mode="never",
|
| 1206 |
)
|
|
@@ -1316,8 +1317,8 @@ image_generation_interface = gr.Interface(
|
|
| 1316 |
outputs=gr.Image(label="Generated Image"),
|
| 1317 |
title="Image Generation",
|
| 1318 |
description=(
|
| 1319 |
-
"<div style=\"text-align:center\">Generate images via Hugging Face
|
| 1320 |
-
"Default model is FLUX.1-Krea
|
| 1321 |
),
|
| 1322 |
api_description=(
|
| 1323 |
"Generate a single image from a text prompt using a Hugging Face model via serverless inference. "
|
|
@@ -1506,7 +1507,7 @@ video_generation_interface = gr.Interface(
|
|
| 1506 |
outputs=gr.Video(label="Generated Video", show_download_button=True, format="mp4"),
|
| 1507 |
title="Video Generation",
|
| 1508 |
description=(
|
| 1509 |
-
"<div style=\"text-align:center\">Generate short videos via Hugging Face
|
| 1510 |
"Default model is Wan2.2-T2V-A14B.</div>"
|
| 1511 |
),
|
| 1512 |
api_description=(
|
|
|
|
| 828 |
4. Operation is protected by an in‑process reentrant lock only (no cross‑process locking).
|
| 829 |
|
| 830 |
Returns:
|
| 831 |
+
str: Human readable confirmation containing the new memory UUID (full or prefix
|
| 832 |
|
| 833 |
Security / Privacy:
|
| 834 |
Data is plaintext JSON on local disk; do NOT store secrets or regulated data.
|
|
|
|
| 1004 |
outputs=gr.Textbox(label="Search Results", interactive=False),
|
| 1005 |
title="DuckDuckGo Search",
|
| 1006 |
description=(
|
| 1007 |
+
"<div style=\"text-align:center\">Web search with readable output format. Supports advanced search operators.</div>"
|
| 1008 |
),
|
| 1009 |
api_description=(
|
| 1010 |
"Run a DuckDuckGo search and return numbered results with URLs, titles, and summaries. "
|
|
|
|
| 1057 |
}
|
| 1058 |
.gradio-container h1::after {
|
| 1059 |
grid-row: 3;
|
| 1060 |
+
content: "Authentication is optional but Image/Video Generation require a `HF_READ_TOKEN` in env secrets. They are hidden otherwise. Same with Memory (intended for local use).";
|
| 1061 |
display: block;
|
| 1062 |
font-size: 1rem;
|
| 1063 |
font-weight: 400;
|
|
|
|
| 1090 |
outputs=gr.Audio(label="Audio", type="numpy", format="wav", show_download_button=True),
|
| 1091 |
title="Kokoro TTS",
|
| 1092 |
description=(
|
| 1093 |
+
"<div style=\"text-align:center\">Generate speech with Kokoro-82M. Supports multiple languages and accents. Runs on CPU or CUDA if available.</div>"
|
| 1094 |
),
|
| 1095 |
api_description=(
|
| 1096 |
"Synthesize speech from text using Kokoro-82M TTS model. Returns (sample_rate, waveform) suitable for playback. "
|
|
|
|
| 1102 |
flagging_mode="never",
|
| 1103 |
)
|
| 1104 |
|
| 1105 |
+
def Memory_Manager(
|
| 1106 |
action: Annotated[Literal["save","list","search","delete"], "Action to perform: save | list | search | delete"],
|
| 1107 |
+
text: Annotated[Optional[str], "Text content (Save only)"] = None,
|
| 1108 |
+
tags: Annotated[Optional[str], "Comma-separated tags (Save only)"] = None,
|
| 1109 |
+
query: Annotated[Optional[str], "Search query terms (Search only)"] = None,
|
| 1110 |
+
limit: Annotated[int, "Max results (List/Search only)"] = 20,
|
| 1111 |
+
memory_id: Annotated[Optional[str], "Full UUID or unique prefix (Delete only)"] = None,
|
| 1112 |
+
include_tags: Annotated[bool, "Include tags (List/Search only)"] = True,
|
| 1113 |
) -> str:
|
| 1114 |
"""Manage lightweight local JSON “memories” (save | list | search | delete) in one MCP tool.
|
| 1115 |
|
|
|
|
| 1183 |
return "Error: invalid action (use save|list|search|delete)."
|
| 1184 |
|
| 1185 |
memory_interface = gr.Interface(
|
| 1186 |
+
fn=Memory_Manager,
|
| 1187 |
inputs=[
|
| 1188 |
gr.Dropdown(label="Action", choices=["save","list","search","delete"], value="list"),
|
| 1189 |
gr.Textbox(label="Text", lines=3, placeholder="Memory text (save)"),
|
|
|
|
| 1196 |
outputs=gr.Textbox(label="Result", lines=14),
|
| 1197 |
title="Memory Manager",
|
| 1198 |
description=(
|
| 1199 |
+
"<div style=\"text-align:center\">Lightweight local JSON memory store (no external DB). Choose an Action, fill only the relevant fields, and run.</div>"
|
| 1200 |
),
|
| 1201 |
api_description=(
|
| 1202 |
"Manage short text memories with optional tags. Actions: save(text,tags), list(limit,include_tags), "
|
| 1203 |
+
"search(query,limit,include_tags), delete(memory_id). Returns plaintext JSON. Action parameter is always required. "
|
| 1204 |
+
"Use Memory_Manager whenever you are given information worth remembering about the user, and search for memories when relevant."
|
| 1205 |
),
|
| 1206 |
flagging_mode="never",
|
| 1207 |
)
|
|
|
|
| 1317 |
outputs=gr.Image(label="Generated Image"),
|
| 1318 |
title="Image Generation",
|
| 1319 |
description=(
|
| 1320 |
+
"<div style=\"text-align:center\">Generate images via Hugging Face serverless inference. "
|
| 1321 |
+
"Default model is FLUX.1-Krea-dev.</div>"
|
| 1322 |
),
|
| 1323 |
api_description=(
|
| 1324 |
"Generate a single image from a text prompt using a Hugging Face model via serverless inference. "
|
|
|
|
| 1507 |
outputs=gr.Video(label="Generated Video", show_download_button=True, format="mp4"),
|
| 1508 |
title="Video Generation",
|
| 1509 |
description=(
|
| 1510 |
+
"<div style=\"text-align:center\">Generate short videos via Hugging Face serverless inference. "
|
| 1511 |
"Default model is Wan2.2-T2V-A14B.</div>"
|
| 1512 |
),
|
| 1513 |
api_description=(
|