Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,6 +7,19 @@ 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: #it's import to specify the return type
|
|
@@ -42,8 +55,8 @@ final_answer = FinalAnswerTool()
|
|
| 42 |
model = HfApiModel(
|
| 43 |
max_tokens=2096,
|
| 44 |
temperature=0.5,
|
| 45 |
-
|
| 46 |
-
model_id='moonshotai/Moonlight-16B-A3B-Instruct',
|
| 47 |
custom_role_conversions=None,
|
| 48 |
)
|
| 49 |
|
|
|
|
| 7 |
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
|
| 10 |
+
|
| 11 |
+
import os
|
| 12 |
+
from huggingface_hub import InferenceClient
|
| 13 |
+
|
| 14 |
+
HF_API_KEY = os.getenv("HF_API_KEY")
|
| 15 |
+
if not HF_API_KEY:
|
| 16 |
+
raise ValueError("HF_API_KEY is not set. Please add it as a secret in your Hugging Face Space settings.")
|
| 17 |
+
|
| 18 |
+
client = InferenceClient(token=HF_API_KEY)
|
| 19 |
+
|
| 20 |
+
response = client.text_generation("Hello!", model="Qwen/Qwen2.5-Coder-32B-Instruct")
|
| 21 |
+
print(response)
|
| 22 |
+
|
| 23 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 24 |
@tool
|
| 25 |
def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
|
|
|
|
| 55 |
model = HfApiModel(
|
| 56 |
max_tokens=2096,
|
| 57 |
temperature=0.5,
|
| 58 |
+
model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
|
| 59 |
+
#model_id='moonshotai/Moonlight-16B-A3B-Instruct',
|
| 60 |
custom_role_conversions=None,
|
| 61 |
)
|
| 62 |
|