dmfelder commited on
Commit
dd58531
·
verified ·
1 Parent(s): 782f291

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -11
app.py CHANGED
@@ -11,17 +11,11 @@ import requests
11
  import pandas as pd
12
  import tempfile
13
  import gradio as gr
14
- from transformers import pipeline
15
- from PIL import Image
16
- import soundfile as sf
17
- import numpy as np
18
- from requests.adapters import HTTPAdapter
19
- from urllib3.util.retry import Retry
20
-
21
  # CORRECTED IMPORTS:
 
22
  from huggingface_hub import InferenceClient
23
- # The Agent class for the course is typically found within transformers.agents
24
- from transformers.agents import Agent
25
 
26
  # Setup log file path
27
  log_path = os.path.join(os.getcwd(), f"agent_log_{datetime.now().strftime('%Y%m%d_%H%M%S')}.log")
@@ -141,7 +135,7 @@ class SmartAgent:
141
  if agent_info.get("username") == self.username:
142
  self.agent_id = agent_info["agent_id"]
143
  logging.info(f"Re-using existing agent with ID: {self.agent_id}")
144
- # Instantiate Agent from transformers.agents
145
  return Agent(id=self.agent_id, client=client)
146
 
147
  # If no existing agent, create a new one
@@ -150,7 +144,7 @@ class SmartAgent:
150
  created_agent_info = create_agent_resp.json()
151
  self.agent_id = created_agent_info["agent_id"]
152
  logging.info(f"Created new agent with ID: {self.agent_id}")
153
- # Instantiate Agent from transformers.agents
154
  return Agent(id=self.agent_id, client=client)
155
 
156
  except requests.exceptions.RequestException as req_e:
 
11
  import pandas as pd
12
  import tempfile
13
  import gradio as gr
 
 
 
 
 
 
 
14
  # CORRECTED IMPORTS:
15
+ from transformers import pipeline, Agent # Assuming Agent is directly available from transformers
16
  from huggingface_hub import InferenceClient
17
+ from requests.adapters import HTTPAdapter
18
+ from urllib3.util.retry import Retry
19
 
20
  # Setup log file path
21
  log_path = os.path.join(os.getcwd(), f"agent_log_{datetime.now().strftime('%Y%m%d_%H%M%S')}.log")
 
135
  if agent_info.get("username") == self.username:
136
  self.agent_id = agent_info["agent_id"]
137
  logging.info(f"Re-using existing agent with ID: {self.agent_id}")
138
+ # Instantiate Agent from transformers
139
  return Agent(id=self.agent_id, client=client)
140
 
141
  # If no existing agent, create a new one
 
144
  created_agent_info = create_agent_resp.json()
145
  self.agent_id = created_agent_info["agent_id"]
146
  logging.info(f"Created new agent with ID: {self.agent_id}")
147
+ # Instantiate Agent from transformers
148
  return Agent(id=self.agent_id, client=client)
149
 
150
  except requests.exceptions.RequestException as req_e: