Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -29,7 +29,6 @@ custom_css = """
|
|
29 |
}
|
30 |
"""
|
31 |
|
32 |
-
|
33 |
def predict(prompt):
|
34 |
# Create the model
|
35 |
generation_config = {
|
@@ -45,22 +44,20 @@ def predict(prompt):
|
|
45 |
generation_config=generation_config,
|
46 |
)
|
47 |
|
48 |
-
|
49 |
-
# Create the tools configuration
|
50 |
-
|
51 |
-
tools_config = glm.ToolConfig(
|
52 |
-
function_declarations=[],
|
53 |
-
search_queries=[prompt],
|
54 |
-
)
|
55 |
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
|
61 |
-
|
62 |
-
|
|
|
|
|
63 |
|
|
|
|
|
64 |
|
65 |
# Create the Gradio interface
|
66 |
with gr.Blocks(css=custom_css) as demo:
|
|
|
29 |
}
|
30 |
"""
|
31 |
|
|
|
32 |
def predict(prompt):
|
33 |
# Create the model
|
34 |
generation_config = {
|
|
|
44 |
generation_config=generation_config,
|
45 |
)
|
46 |
|
47 |
+
# Create the tools configuration
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
|
49 |
+
tools_config = glm.ToolConfig(
|
50 |
+
function_declarations=[],
|
51 |
+
search_queries=[prompt],
|
52 |
+
)
|
53 |
|
54 |
+
response = model.generate_content(
|
55 |
+
contents=[prompt], # Directly pass the prompt
|
56 |
+
tools=[tools_config]
|
57 |
+
)
|
58 |
|
59 |
+
if response and response.text:
|
60 |
+
return response.text
|
61 |
|
62 |
# Create the Gradio interface
|
63 |
with gr.Blocks(css=custom_css) as demo:
|