Update app.py file to include model
Browse files
app.py
CHANGED
|
@@ -3,6 +3,14 @@ import gradio as gr
|
|
| 3 |
import requests
|
| 4 |
import inspect
|
| 5 |
import pandas as pd
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
# (Keep Constants as is)
|
| 8 |
# --- Constants ---
|
|
@@ -17,6 +25,18 @@ class BasicAgent:
|
|
| 17 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 18 |
fixed_answer = "This is a default answer."
|
| 19 |
print(f"Agent returning fixed answer: {fixed_answer}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
return fixed_answer
|
| 21 |
|
| 22 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
|
|
| 3 |
import requests
|
| 4 |
import inspect
|
| 5 |
import pandas as pd
|
| 6 |
+
from smolagents import CodeAgent, DuckDuckGoSearchTool, WebSearchTool, HfApiModel,load_tool,tool
|
| 7 |
+
import datetime
|
| 8 |
+
import requests
|
| 9 |
+
import pytz
|
| 10 |
+
import yaml
|
| 11 |
+
from tools.final_answer import FinalAnswerTool
|
| 12 |
+
from PIL import Image
|
| 13 |
+
from io import BytesIO
|
| 14 |
|
| 15 |
# (Keep Constants as is)
|
| 16 |
# --- Constants ---
|
|
|
|
| 25 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 26 |
fixed_answer = "This is a default answer."
|
| 27 |
print(f"Agent returning fixed answer: {fixed_answer}")
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
model = HfApiModel(
|
| 31 |
+
max_tokens=2096,
|
| 32 |
+
temperature=0.0,
|
| 33 |
+
model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
|
| 34 |
+
custom_role_conversions=None,
|
| 35 |
+
)
|
| 36 |
+
|
| 37 |
+
with open("prompts.yaml", 'r') as stream:
|
| 38 |
+
prompt_templates = yaml.safe_load(stream)
|
| 39 |
+
|
| 40 |
return fixed_answer
|
| 41 |
|
| 42 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|