Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- .gradio/certificate.pem +31 -0
- README.md +2 -0
- __pycache__/Gradio_UI.cpython-311.pyc +0 -0
- app.py +27 -11
- requirements.txt +2 -1
- tools/__pycache__/final_answer.cpython-311.pyc +0 -0
- tools/__pycache__/visit_webpage.cpython-311.pyc +0 -0
- tools/__pycache__/web_search.cpython-311.pyc +0 -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/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5M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NzktHCgKQ5
|
| 24 |
+
ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJwTdwJx4nLCgdNbOhdjsnvzqvHu7Ur
|
| 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-----
|
README.md
CHANGED
|
@@ -16,3 +16,5 @@ tags:
|
|
| 16 |
---
|
| 17 |
|
| 18 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
| 16 |
---
|
| 17 |
|
| 18 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
| 19 |
+
|
| 20 |
+
To run the app locally, check out the run spaces documentation where you can run it locally or wit Docker at https://huggingface.co/docs/hub/spaces-run-with-docker
|
__pycache__/Gradio_UI.cpython-311.pyc
ADDED
|
Binary file (13.3 kB). View file
|
|
|
app.py
CHANGED
|
@@ -4,13 +4,16 @@ import requests
|
|
| 4 |
import pytz
|
| 5 |
import yaml
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
|
| 10 |
-
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 11 |
@tool
|
| 12 |
-
def my_custom_tool(arg1:str, arg2:int)-> str:
|
| 13 |
-
|
| 14 |
"""A tool that does nothing yet
|
| 15 |
Args:
|
| 16 |
arg1: the first argument
|
|
@@ -32,6 +35,20 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
| 32 |
return f"The current local time in {timezone} is: {local_time}"
|
| 33 |
except Exception as e:
|
| 34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
|
| 37 |
final_answer = FinalAnswerTool()
|
|
@@ -40,13 +57,12 @@ final_answer = FinalAnswerTool()
|
|
| 40 |
# model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
|
| 41 |
|
| 42 |
model = HfApiModel(
|
| 43 |
-
max_tokens=2096,
|
| 44 |
-
temperature=0.5,
|
| 45 |
-
model_id='Qwen/Qwen2.5-Coder-32B-Instruct'
|
| 46 |
-
custom_role_conversions=None,
|
| 47 |
)
|
| 48 |
|
| 49 |
-
|
| 50 |
# Import tool from Hub
|
| 51 |
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
| 52 |
|
|
@@ -55,15 +71,15 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 55 |
|
| 56 |
agent = CodeAgent(
|
| 57 |
model=model,
|
| 58 |
-
|
|
|
|
| 59 |
max_steps=6,
|
| 60 |
verbosity_level=1,
|
| 61 |
grammar=None,
|
| 62 |
planning_interval=None,
|
| 63 |
name=None,
|
| 64 |
description=None,
|
| 65 |
-
prompt_templates=prompt_templates
|
| 66 |
)
|
| 67 |
|
| 68 |
-
|
| 69 |
GradioUI(agent).launch()
|
|
|
|
| 4 |
import pytz
|
| 5 |
import yaml
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
| 7 |
+
from tools.visit_webpage import VisitWebpageTool
|
| 8 |
+
|
| 9 |
+
# Custom imports
|
| 10 |
+
import requests
|
| 11 |
|
| 12 |
from Gradio_UI import GradioUI
|
| 13 |
|
|
|
|
| 14 |
@tool
|
| 15 |
+
def my_custom_tool(arg1:str, arg2:int)-> str:
|
| 16 |
+
|
| 17 |
"""A tool that does nothing yet
|
| 18 |
Args:
|
| 19 |
arg1: the first argument
|
|
|
|
| 35 |
return f"The current local time in {timezone} is: {local_time}"
|
| 36 |
except Exception as e:
|
| 37 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 38 |
+
|
| 39 |
+
@tool
|
| 40 |
+
def get_crypto_price_today (ticker: str) -> dict:
|
| 41 |
+
"""A tool that fetches the latest price for any cryptocurrency ticker.
|
| 42 |
+
|
| 43 |
+
Args:
|
| 44 |
+
ticker: Crypto ticker (e.g. 'BTC' for Bitcoin, 'ETH' for Ethereum, 'SOL' for Solana)"""
|
| 45 |
+
|
| 46 |
+
try:
|
| 47 |
+
key = f"https://api.binance.com/api/v3/ticker/price?symbol={ticker}"
|
| 48 |
+
data = requests.get(key).json()
|
| 49 |
+
return f"{data['ticker']} is {data['price']}."
|
| 50 |
+
except Exception as e:
|
| 51 |
+
return {"Error:", str(e)}
|
| 52 |
|
| 53 |
|
| 54 |
final_answer = FinalAnswerTool()
|
|
|
|
| 57 |
# model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
|
| 58 |
|
| 59 |
model = HfApiModel(
|
| 60 |
+
max_tokens=2096,
|
| 61 |
+
temperature=0.5,
|
| 62 |
+
model_id='Qwen/Qwen2.5-Coder-32B-Instruct',
|
| 63 |
+
custom_role_conversions=None,
|
| 64 |
)
|
| 65 |
|
|
|
|
| 66 |
# Import tool from Hub
|
| 67 |
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
| 68 |
|
|
|
|
| 71 |
|
| 72 |
agent = CodeAgent(
|
| 73 |
model=model,
|
| 74 |
+
additional_authorized_imports=['requests'],
|
| 75 |
+
tools=[final_answer, get_current_time_in_timezone, image_generation_tool, get_crypto_price_today],
|
| 76 |
max_steps=6,
|
| 77 |
verbosity_level=1,
|
| 78 |
grammar=None,
|
| 79 |
planning_interval=None,
|
| 80 |
name=None,
|
| 81 |
description=None,
|
| 82 |
+
prompt_templates=prompt_templates,
|
| 83 |
)
|
| 84 |
|
|
|
|
| 85 |
GradioUI(agent).launch()
|
requirements.txt
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
markdownify
|
| 2 |
smolagents==1.13.0
|
| 3 |
requests
|
| 4 |
-
|
| 5 |
pandas
|
|
|
|
|
|
| 1 |
markdownify
|
| 2 |
smolagents==1.13.0
|
| 3 |
requests
|
| 4 |
+
ddgs
|
| 5 |
pandas
|
| 6 |
+
requests
|
tools/__pycache__/final_answer.cpython-311.pyc
ADDED
|
Binary file (1.21 kB). View file
|
|
|
tools/__pycache__/visit_webpage.cpython-311.pyc
ADDED
|
Binary file (2.91 kB). View file
|
|
|
tools/__pycache__/web_search.cpython-311.pyc
ADDED
|
Binary file (2.69 kB). View file
|
|
|