Spaces:
Sleeping
Sleeping
Sagar Sanghani
commited on
Commit
·
51d5738
1
Parent(s):
b64c7e2
link up apppy
Browse files
app.py
CHANGED
|
@@ -3,6 +3,7 @@ import gradio as gr
|
|
| 3 |
import requests
|
| 4 |
import inspect
|
| 5 |
import pandas as pd
|
|
|
|
| 6 |
|
| 7 |
# (Keep Constants as is)
|
| 8 |
# --- Constants ---
|
|
@@ -13,9 +14,11 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
| 13 |
class BasicAgent:
|
| 14 |
def __init__(self):
|
| 15 |
print("BasicAgent initialized.")
|
|
|
|
|
|
|
| 16 |
def __call__(self, question: str) -> str:
|
| 17 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 18 |
-
fixed_answer =
|
| 19 |
print(f"Agent returning fixed answer: {fixed_answer}")
|
| 20 |
return fixed_answer
|
| 21 |
|
|
|
|
| 3 |
import requests
|
| 4 |
import inspect
|
| 5 |
import pandas as pd
|
| 6 |
+
from model import Model
|
| 7 |
|
| 8 |
# (Keep Constants as is)
|
| 9 |
# --- Constants ---
|
|
|
|
| 14 |
class BasicAgent:
|
| 15 |
def __init__(self):
|
| 16 |
print("BasicAgent initialized.")
|
| 17 |
+
self.model = Model()
|
| 18 |
+
|
| 19 |
def __call__(self, question: str) -> str:
|
| 20 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 21 |
+
fixed_answer = self.model.get_answer(question)
|
| 22 |
print(f"Agent returning fixed answer: {fixed_answer}")
|
| 23 |
return fixed_answer
|
| 24 |
|
model.py
CHANGED
|
@@ -13,7 +13,9 @@ class Model:
|
|
| 13 |
def __init__(self):
|
| 14 |
#load_dotenv(find_dotenv())
|
| 15 |
self.token = os.getenv("HF_TOKEN")
|
|
|
|
| 16 |
self.system_prompt = get_prompt()
|
|
|
|
| 17 |
self.agent_executor = self.setup_model()
|
| 18 |
|
| 19 |
# Define a tool for the agent to use
|
|
|
|
| 13 |
def __init__(self):
|
| 14 |
#load_dotenv(find_dotenv())
|
| 15 |
self.token = os.getenv("HF_TOKEN")
|
| 16 |
+
print(f"token: {self.token}")
|
| 17 |
self.system_prompt = get_prompt()
|
| 18 |
+
print(f"system_prompt: {self.system_prompt}")
|
| 19 |
self.agent_executor = self.setup_model()
|
| 20 |
|
| 21 |
# Define a tool for the agent to use
|