Spaces:
Sleeping
Sleeping
Commit ·
7b6b51e
1
Parent(s): b45f046
updated app.py
Browse files- .gradio/certificate.pem +31 -0
- app.py +9 -6
- prompts.yaml +2 -0
- question_retriever.ipynb +4 -4
- requirements.txt +2 -0
.gradio/certificate.pem
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
-----BEGIN CERTIFICATE-----
|
| 2 |
+
MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw
|
| 3 |
+
TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh
|
| 4 |
+
cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4
|
| 5 |
+
WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJu
|
| 6 |
+
ZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBY
|
| 7 |
+
MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54rVygc
|
| 8 |
+
h77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+
|
| 9 |
+
0TM8ukj13Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6U
|
| 10 |
+
A5/TR5d8mUgjU+g4rk8Kb4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3d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|
| 25 |
+
TkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nxe5AW0wdeRlN8NwdC
|
| 26 |
+
jNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZAJzVc
|
| 27 |
+
oyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq
|
| 28 |
+
4RgqsahDYVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPA
|
| 29 |
+
mRGunUHBcnWEvgJBQl9nJEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57d
|
| 30 |
+
emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc=
|
| 31 |
+
-----END CERTIFICATE-----
|
app.py
CHANGED
|
@@ -1,9 +1,10 @@
|
|
| 1 |
import yaml
|
| 2 |
import os
|
| 3 |
-
from smolagents import GradioUI, CodeAgent, InferenceClientModel,
|
| 4 |
import pandas as pd
|
| 5 |
import requests
|
| 6 |
from io import BytesIO
|
|
|
|
| 7 |
|
| 8 |
# Get current directory path
|
| 9 |
CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
|
|
@@ -22,11 +23,13 @@ from tools.final_answer import FinalAnswerTool as FinalAnswer
|
|
| 22 |
# from tools.excel_analyzer import ExcelAnalyzerTool
|
| 23 |
# from tools.wikipedia_search import WikipediaSearchTool
|
| 24 |
|
| 25 |
-
|
| 26 |
answer_question = AnswerQuestion()
|
| 27 |
web_search = WebSearch()
|
| 28 |
visit_webpage = VisitWebpage()
|
| 29 |
final_answer = FinalAnswer()
|
|
|
|
|
|
|
| 30 |
# youtube_analyzer = YouTubeVideoAnalysisTool()
|
| 31 |
# file_reader = FileReaderTool()
|
| 32 |
# code_executor = CodeExecutorTool()
|
|
@@ -37,9 +40,8 @@ final_answer = FinalAnswer()
|
|
| 37 |
# wikipedia_search = WikipediaSearchTool()
|
| 38 |
|
| 39 |
model = InferenceClientModel(
|
| 40 |
-
model_id=
|
| 41 |
-
|
| 42 |
-
)
|
| 43 |
|
| 44 |
with open(os.path.join(CURRENT_DIR, "prompts.yaml"), 'r') as stream:
|
| 45 |
prompt_templates = yaml.safe_load(stream)
|
|
@@ -50,6 +52,7 @@ agent_submission_agent = CodeAgent(
|
|
| 50 |
answer_question,
|
| 51 |
web_search,
|
| 52 |
visit_webpage,
|
|
|
|
| 53 |
final_answer,
|
| 54 |
# youtube_analyzer,
|
| 55 |
# file_reader,
|
|
@@ -74,4 +77,4 @@ agent_submission_agent = CodeAgent(
|
|
| 74 |
)
|
| 75 |
|
| 76 |
if __name__ == "__main__":
|
| 77 |
-
GradioUI(agent_submission_agent).launch()
|
|
|
|
| 1 |
import yaml
|
| 2 |
import os
|
| 3 |
+
from smolagents import GradioUI, CodeAgent, InferenceClientModel, PythonInterpreterTool
|
| 4 |
import pandas as pd
|
| 5 |
import requests
|
| 6 |
from io import BytesIO
|
| 7 |
+
from huggingface_hub import InferenceClient
|
| 8 |
|
| 9 |
# Get current directory path
|
| 10 |
CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
|
|
|
|
| 23 |
# from tools.excel_analyzer import ExcelAnalyzerTool
|
| 24 |
# from tools.wikipedia_search import WikipediaSearchTool
|
| 25 |
|
| 26 |
+
# Initialize tools
|
| 27 |
answer_question = AnswerQuestion()
|
| 28 |
web_search = WebSearch()
|
| 29 |
visit_webpage = VisitWebpage()
|
| 30 |
final_answer = FinalAnswer()
|
| 31 |
+
python_interpreter = PythonInterpreterTool()
|
| 32 |
+
|
| 33 |
# youtube_analyzer = YouTubeVideoAnalysisTool()
|
| 34 |
# file_reader = FileReaderTool()
|
| 35 |
# code_executor = CodeExecutorTool()
|
|
|
|
| 40 |
# wikipedia_search = WikipediaSearchTool()
|
| 41 |
|
| 42 |
model = InferenceClientModel(
|
| 43 |
+
model_id="Qwen/Qwen2.5-Coder-32B-Instruct",
|
| 44 |
+
provider="together")
|
|
|
|
| 45 |
|
| 46 |
with open(os.path.join(CURRENT_DIR, "prompts.yaml"), 'r') as stream:
|
| 47 |
prompt_templates = yaml.safe_load(stream)
|
|
|
|
| 52 |
answer_question,
|
| 53 |
web_search,
|
| 54 |
visit_webpage,
|
| 55 |
+
python_interpreter,
|
| 56 |
final_answer,
|
| 57 |
# youtube_analyzer,
|
| 58 |
# file_reader,
|
|
|
|
| 77 |
)
|
| 78 |
|
| 79 |
if __name__ == "__main__":
|
| 80 |
+
GradioUI(agent_submission_agent).launch()
|
prompts.yaml
CHANGED
|
@@ -9,6 +9,8 @@
|
|
| 9 |
These print outputs will then appear in the 'Observation:' field, which will be available as input for the next step.
|
| 10 |
In the end you have to return a final answer using the `final_answer` tool.
|
| 11 |
|
|
|
|
|
|
|
| 12 |
Here are a few examples using notional tools:
|
| 13 |
---
|
| 14 |
Task: "Generate an image of the oldest person in this document."
|
|
|
|
| 9 |
These print outputs will then appear in the 'Observation:' field, which will be available as input for the next step.
|
| 10 |
In the end you have to return a final answer using the `final_answer` tool.
|
| 11 |
|
| 12 |
+
Never call tools (web_search, visit_webpage, etc.) from within python_interpreter code blocks. Each tool must be called separately in the Thought-Code-Observation cycle.
|
| 13 |
+
|
| 14 |
Here are a few examples using notional tools:
|
| 15 |
---
|
| 16 |
Task: "Generate an image of the oldest person in this document."
|
question_retriever.ipynb
CHANGED
|
@@ -228,22 +228,22 @@
|
|
| 228 |
},
|
| 229 |
{
|
| 230 |
"cell_type": "code",
|
| 231 |
-
"execution_count":
|
| 232 |
"metadata": {},
|
| 233 |
"outputs": [
|
| 234 |
{
|
| 235 |
"data": {
|
| 236 |
"text/plain": [
|
| 237 |
-
"'
|
| 238 |
]
|
| 239 |
},
|
| 240 |
-
"execution_count":
|
| 241 |
"metadata": {},
|
| 242 |
"output_type": "execute_result"
|
| 243 |
}
|
| 244 |
],
|
| 245 |
"source": [
|
| 246 |
-
"df_level1.loc[
|
| 247 |
]
|
| 248 |
},
|
| 249 |
{
|
|
|
|
| 228 |
},
|
| 229 |
{
|
| 230 |
"cell_type": "code",
|
| 231 |
+
"execution_count": 16,
|
| 232 |
"metadata": {},
|
| 233 |
"outputs": [
|
| 234 |
{
|
| 235 |
"data": {
|
| 236 |
"text/plain": [
|
| 237 |
+
"'Of the authors (First M. Last) that worked on the paper \"Pie Menus or Linear Menus, Which Is Better?\" in 2015, what was the title of the first paper authored by the one that had authored prior papers?'"
|
| 238 |
]
|
| 239 |
},
|
| 240 |
+
"execution_count": 16,
|
| 241 |
"metadata": {},
|
| 242 |
"output_type": "execute_result"
|
| 243 |
}
|
| 244 |
],
|
| 245 |
"source": [
|
| 246 |
+
"df_level1.loc[5, 'Question']"
|
| 247 |
]
|
| 248 |
},
|
| 249 |
{
|
requirements.txt
CHANGED
|
@@ -2,3 +2,5 @@ duckduckgo_search
|
|
| 2 |
markdownify
|
| 3 |
requests
|
| 4 |
smolagents
|
|
|
|
|
|
|
|
|
| 2 |
markdownify
|
| 3 |
requests
|
| 4 |
smolagents
|
| 5 |
+
langchain
|
| 6 |
+
langchain-community
|