razvanfischer commited on
Commit
ef1b18f
·
1 Parent(s): 5f5a29d

First actual attempt

Browse files
.idea/Agents_Course_Final_Project.iml CHANGED
@@ -4,7 +4,7 @@
4
  <content url="file://$MODULE_DIR$">
5
  <excludeFolder url="file://$MODULE_DIR$/venv" />
6
  </content>
7
- <orderEntry type="jdk" jdkName="Python 3.11 (Agents_Course_Final_Project)" jdkType="Python SDK" />
8
  <orderEntry type="sourceFolder" forTests="false" />
9
  </component>
10
  <component name="PyDocumentationSettings">
 
4
  <content url="file://$MODULE_DIR$">
5
  <excludeFolder url="file://$MODULE_DIR$/venv" />
6
  </content>
7
+ <orderEntry type="jdk" jdkName="$USER_HOME$/anaconda3" jdkType="Python SDK" />
8
  <orderEntry type="sourceFolder" forTests="false" />
9
  </component>
10
  <component name="PyDocumentationSettings">
.idea/misc.xml CHANGED
@@ -1,4 +1,4 @@
1
  <?xml version="1.0" encoding="UTF-8"?>
2
  <project version="4">
3
- <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11 (Agents_Course_Final_Project)" project-jdk-type="Python SDK" />
4
  </project>
 
1
  <?xml version="1.0" encoding="UTF-8"?>
2
  <project version="4">
3
+ <component name="ProjectRootManager" version="2" project-jdk-name="$USER_HOME$/anaconda3" project-jdk-type="Python SDK" />
4
  </project>
app.py CHANGED
@@ -52,16 +52,6 @@ async def search_web(query: str) -> str:
52
  client = DuckDuckGoSearchToolSpec()
53
  search_res = client.duckduckgo_instant_search(query)
54
  return str(search_res)
55
- # print("Search res: ", search_res)
56
- # web_pages = [search_res[i]['url'] if 'url' in search_res[i] else None for i in range(len(search_res))]
57
- # web_pages = [web_pages[0]]
58
- # documents = SimpleWebPageReader(html_to_text=True).load_data(
59
- # web_pages
60
- # )
61
- # return documents
62
- # # documents = SimpleWebPageReader(html_to_text=True).load_data(
63
- # # ["http://paulgraham.com/worked.html"]
64
- # # )
65
 
66
  def run_and_submit_all( profile: gr.OAuthProfile | None):
67
  """
@@ -216,28 +206,28 @@ with gr.Blocks() as demo:
216
  )
217
 
218
  if __name__ == "__main__":
219
- agent = BasicAgent()
220
- answ = asyncio.run(agent("Who is Michael Jackson?"))
221
-
222
- # print("\n" + "-"*30 + " App Starting " + "-"*30)
223
- # # Check for SPACE_HOST and SPACE_ID at startup for information
224
- # space_host_startup = os.getenv("SPACE_HOST")
225
- # space_id_startup = os.getenv("SPACE_ID") # Get SPACE_ID at startup
226
- #
227
- # if space_host_startup:
228
- # print(f"✅ SPACE_HOST found: {space_host_startup}")
229
- # print(f" Runtime URL should be: https://{space_host_startup}.hf.space")
230
- # else:
231
- # print("ℹ️ SPACE_HOST environment variable not found (running locally?).")
232
- #
233
- # if space_id_startup: # Print repo URLs if SPACE_ID is found
234
- # print(f"✅ SPACE_ID found: {space_id_startup}")
235
- # print(f" Repo URL: https://huggingface.co/spaces/{space_id_startup}")
236
- # print(f" Repo Tree URL: https://huggingface.co/spaces/{space_id_startup}/tree/main")
237
- # else:
238
- # print("ℹ️ SPACE_ID environment variable not found (running locally?). Repo URL cannot be determined.")
239
- #
240
- # print("-"*(60 + len(" App Starting ")) + "\n")
241
- #
242
- # print("Launching Gradio Interface for Basic Agent Evaluation...")
243
- # demo.launch(debug=True, share=False)
 
52
  client = DuckDuckGoSearchToolSpec()
53
  search_res = client.duckduckgo_instant_search(query)
54
  return str(search_res)
 
 
 
 
 
 
 
 
 
 
55
 
56
  def run_and_submit_all( profile: gr.OAuthProfile | None):
57
  """
 
206
  )
207
 
208
  if __name__ == "__main__":
209
+ # agent = BasicAgent()
210
+ # answ = asyncio.run(agent("Who is Michael Jackson?"))
211
+
212
+ print("\n" + "-"*30 + " App Starting " + "-"*30)
213
+ # Check for SPACE_HOST and SPACE_ID at startup for information
214
+ space_host_startup = os.getenv("SPACE_HOST")
215
+ space_id_startup = os.getenv("SPACE_ID") # Get SPACE_ID at startup
216
+
217
+ if space_host_startup:
218
+ print(f"✅ SPACE_HOST found: {space_host_startup}")
219
+ print(f" Runtime URL should be: https://{space_host_startup}.hf.space")
220
+ else:
221
+ print("ℹ️ SPACE_HOST environment variable not found (running locally?).")
222
+
223
+ if space_id_startup: # Print repo URLs if SPACE_ID is found
224
+ print(f"✅ SPACE_ID found: {space_id_startup}")
225
+ print(f" Repo URL: https://huggingface.co/spaces/{space_id_startup}")
226
+ print(f" Repo Tree URL: https://huggingface.co/spaces/{space_id_startup}/tree/main")
227
+ else:
228
+ print("ℹ️ SPACE_ID environment variable not found (running locally?). Repo URL cannot be determined.")
229
+
230
+ print("-"*(60 + len(" App Starting ")) + "\n")
231
+
232
+ print("Launching Gradio Interface for Basic Agent Evaluation...")
233
+ demo.launch(debug=True, share=False)
requirements.txt CHANGED
@@ -1,5 +1,4 @@
1
  gradio
2
- gradio[oauth]
3
  requests
4
  llama-index
5
  llama-index-vector-stores-chroma
 
1
  gradio
 
2
  requests
3
  llama-index
4
  llama-index-vector-stores-chroma