lucaslingle commited on
Commit
6207a8d
·
verified ·
1 Parent(s): d5f0a30

Update app.py

Browse files

t-strings not yet avail on hf spaces

Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -10,6 +10,7 @@ import whisper
10
  import gradio as gr
11
  import inspect
12
  import pandas as pd
 
13
 
14
  # --- constants ---
15
  DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
@@ -97,7 +98,7 @@ class Agent:
97
  )
98
 
99
  def __call__(self, question_text, file_name) -> str:
100
- template = t"""You are a highly precise question-answering agent.
101
  When given a question:
102
  - If necessary, perform a web search using the tool `web_search` to find possible sources of information.
103
  - If the web search only returns titles and short snippets, you MUST visit the actual webpage using the `visit_webpage` tool to read the full content before answering.
@@ -119,7 +120,7 @@ class Agent:
119
  {question_text}
120
  -- end of question --
121
  If the questions mentions the need to use a file, use the following `file_name` value below as the `file_name` parameter in any function calls:
122
- file_name: {file_name}"""
123
  enhanced_question = template.substitute(question_text=question_text, file_name=file_name)
124
  response = self.agent.run(enhanced_question)
125
  return response
 
10
  import gradio as gr
11
  import inspect
12
  import pandas as pd
13
+ from string import Template
14
 
15
  # --- constants ---
16
  DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
 
98
  )
99
 
100
  def __call__(self, question_text, file_name) -> str:
101
+ template = Template("""You are a highly precise question-answering agent.
102
  When given a question:
103
  - If necessary, perform a web search using the tool `web_search` to find possible sources of information.
104
  - If the web search only returns titles and short snippets, you MUST visit the actual webpage using the `visit_webpage` tool to read the full content before answering.
 
120
  {question_text}
121
  -- end of question --
122
  If the questions mentions the need to use a file, use the following `file_name` value below as the `file_name` parameter in any function calls:
123
+ file_name: {file_name}""")
124
  enhanced_question = template.substitute(question_text=question_text, file_name=file_name)
125
  response = self.agent.run(enhanced_question)
126
  return response