Update app.py
Browse files
app.py
CHANGED
|
@@ -1,17 +1,11 @@
|
|
| 1 |
-
|
| 2 |
-
import os
|
| 3 |
-
import re
|
| 4 |
-
import torch
|
| 5 |
-
import gradio as gr
|
| 6 |
-
import requests
|
| 7 |
-
import inspect
|
| 8 |
-
import pandas as pd
|
| 9 |
from langchain_huggingface.llms import HuggingFacePipeline
|
| 10 |
from langchain_core.tools import tool
|
| 11 |
from langchain_core.agents import AgentExecutor, JsonOutputParser
|
| 12 |
from youtube_transcript_api import YouTubeTranscriptApi
|
| 13 |
import chess, chess.engine
|
| 14 |
from bs4 import BeautifulSoup
|
|
|
|
| 15 |
from SPARQLWrapper import SPARQLWrapper, JSON
|
| 16 |
|
| 17 |
# (Keep Constants as is)
|
|
@@ -192,9 +186,13 @@ class BasicAgent:
|
|
| 192 |
# initialize HF inference pipeline once
|
| 193 |
if HF_TOKEN is None:
|
| 194 |
raise ValueError("HF_TOKEN not set in environment")
|
| 195 |
-
self.
|
| 196 |
-
|
| 197 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 198 |
# The GAIA system prompt (no "FINAL ANSWER:" at the end)
|
| 199 |
self.system_prompt = SYSTEM_MESSAGE
|
| 200 |
print("BasicAgent initialized with LLM.")
|
|
|
|
| 1 |
+
import os, re, requests, pandas as pd, gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
from langchain_huggingface.llms import HuggingFacePipeline
|
| 3 |
from langchain_core.tools import tool
|
| 4 |
from langchain_core.agents import AgentExecutor, JsonOutputParser
|
| 5 |
from youtube_transcript_api import YouTubeTranscriptApi
|
| 6 |
import chess, chess.engine
|
| 7 |
from bs4 import BeautifulSoup
|
| 8 |
+
import statsapi
|
| 9 |
from SPARQLWrapper import SPARQLWrapper, JSON
|
| 10 |
|
| 11 |
# (Keep Constants as is)
|
|
|
|
| 186 |
# initialize HF inference pipeline once
|
| 187 |
if HF_TOKEN is None:
|
| 188 |
raise ValueError("HF_TOKEN not set in environment")
|
| 189 |
+
self.llm = HuggingFacePipeline(
|
| 190 |
+
model="distilbert/distilgpt2",
|
| 191 |
+
tokenizer="distilbert/distilgpt2",
|
| 192 |
+
task="text-generation",
|
| 193 |
+
max_new_tokens=16,
|
| 194 |
+
token=HF_TOKEN
|
| 195 |
+
).bind_tools(TOOLS)
|
| 196 |
# The GAIA system prompt (no "FINAL ANSWER:" at the end)
|
| 197 |
self.system_prompt = SYSTEM_MESSAGE
|
| 198 |
print("BasicAgent initialized with LLM.")
|