mgokg commited on
Commit
fa566da
·
verified ·
1 Parent(s): 01fdbba

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -14
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
- try:
49
- # Create the tools configuration
50
-
51
- tools_config = glm.ToolConfig(
52
- function_declarations=[],
53
- search_queries=[prompt],
54
- )
55
 
56
- response = model.generate_content(
57
- contents=[prompt], # Directly pass the prompt
58
- tools=[tools_config]
59
- )
60
 
61
- if response and response.text:
62
- return response.text
 
 
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: