Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -26,7 +26,7 @@ code_model = HfApiModel(
|
|
| 26 |
max_tokens=2096,
|
| 27 |
temperature=0.5,
|
| 28 |
model_id="Qwen/Qwen2.5-Coder-32B-Instruct",
|
| 29 |
-
custom_role_conversions=None
|
| 30 |
)
|
| 31 |
|
| 32 |
# Import tool from Hugging Face Hub safely
|
|
@@ -36,17 +36,16 @@ except Exception as e:
|
|
| 36 |
print(f"Error loading image generation tool: {e}")
|
| 37 |
image_generation_tool = None # Prevent crash if tool fails
|
| 38 |
|
| 39 |
-
|
| 40 |
@tool
|
| 41 |
def ai_regulation_query_tool(query: str) -> str:
|
| 42 |
"""
|
| 43 |
Queries an AI model for information on AI regulation.
|
| 44 |
|
| 45 |
-
|
| 46 |
-
query (str)
|
| 47 |
|
| 48 |
Returns:
|
| 49 |
-
str
|
| 50 |
"""
|
| 51 |
response = ai_regulation_model.generate(prompt=query)
|
| 52 |
if isinstance(response, dict) and "generated_text" in response:
|
|
@@ -54,6 +53,7 @@ def ai_regulation_query_tool(query: str) -> str:
|
|
| 54 |
return "No response generated. Please try again."
|
| 55 |
|
| 56 |
|
|
|
|
| 57 |
@tool
|
| 58 |
def get_current_time_in_timezone(timezone: str) -> str:
|
| 59 |
"""
|
|
|
|
| 26 |
max_tokens=2096,
|
| 27 |
temperature=0.5,
|
| 28 |
model_id="Qwen/Qwen2.5-Coder-32B-Instruct",
|
| 29 |
+
custom_role_conversions=None,
|
| 30 |
)
|
| 31 |
|
| 32 |
# Import tool from Hugging Face Hub safely
|
|
|
|
| 36 |
print(f"Error loading image generation tool: {e}")
|
| 37 |
image_generation_tool = None # Prevent crash if tool fails
|
| 38 |
|
|
|
|
| 39 |
@tool
|
| 40 |
def ai_regulation_query_tool(query: str) -> str:
|
| 41 |
"""
|
| 42 |
Queries an AI model for information on AI regulation.
|
| 43 |
|
| 44 |
+
Arguments:
|
| 45 |
+
query: (str) The user's question regarding AI regulations.
|
| 46 |
|
| 47 |
Returns:
|
| 48 |
+
(str) The response from the AI regulation model.
|
| 49 |
"""
|
| 50 |
response = ai_regulation_model.generate(prompt=query)
|
| 51 |
if isinstance(response, dict) and "generated_text" in response:
|
|
|
|
| 53 |
return "No response generated. Please try again."
|
| 54 |
|
| 55 |
|
| 56 |
+
|
| 57 |
@tool
|
| 58 |
def get_current_time_in_timezone(timezone: str) -> str:
|
| 59 |
"""
|