Spaces:
Sleeping
Sleeping
meirk-brd commited on
Commit ·
6cc7987
1
Parent(s): e5e2636
remove get_gradio_app_code
Browse files
tool.py
CHANGED
|
@@ -107,24 +107,3 @@ class BrightDataSearchTool(Tool):
|
|
| 107 |
def _extract_image_links(self, images: List[Dict[str, Any]]) -> List[str]:
|
| 108 |
return [img.get("link", "") for img in images if img.get("link")]
|
| 109 |
|
| 110 |
-
def _get_gradio_app_code(self, tool_module_name: str = "tool") -> str:
|
| 111 |
-
choices = ["google", "bing", "yandex"]
|
| 112 |
-
return f"""import gradio as gr
|
| 113 |
-
import importlib
|
| 114 |
-
|
| 115 |
-
BrightDataSearchTool = importlib.import_module("{tool_module_name}").BrightDataSearchTool
|
| 116 |
-
tool = BrightDataSearchTool()
|
| 117 |
-
|
| 118 |
-
def run(query, engine):
|
| 119 |
-
return tool(query=query, engine=engine)
|
| 120 |
-
|
| 121 |
-
with gr.Blocks() as demo:
|
| 122 |
-
gr.Markdown("### Bright Data search")
|
| 123 |
-
query = gr.Textbox(label="Query")
|
| 124 |
-
engine = gr.Dropdown(choices={choices}, label="Engine", value="google")
|
| 125 |
-
run_btn = gr.Button("Run")
|
| 126 |
-
output = gr.Textbox(label="Output", lines=12)
|
| 127 |
-
run_btn.click(run, inputs=[query, engine], outputs=output)
|
| 128 |
-
|
| 129 |
-
demo.launch()
|
| 130 |
-
"""
|
|
|
|
| 107 |
def _extract_image_links(self, images: List[Dict[str, Any]]) -> List[str]:
|
| 108 |
return [img.get("link", "") for img in images if img.get("link")]
|
| 109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|