Leonardo commited on
Commit
abcff05
·
verified ·
1 Parent(s): 1296c52

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -12
app.py CHANGED
@@ -7,10 +7,11 @@ import re
7
  import shutil
8
  from typing import Optional
9
 
 
10
  from dotenv import load_dotenv
11
  from huggingface_hub import login
12
- import gradio as gr
13
-
14
  from scripts.text_inspector_tool import TextInspectorTool
15
  from scripts.text_web_browser import (
16
  ArchiveSearchTool,
@@ -22,20 +23,17 @@ from scripts.text_web_browser import (
22
  VisitTool,
23
  )
24
  from scripts.visual_qa import visualizer
25
- from scripts.text_cleaner_tool import TextCleanerTool
26
- from scripts.flux_lora_tool import FluxLoRATool
27
-
28
  from smolagents import (
29
  CodeAgent,
 
30
  HfApiModel,
31
  LiteLLMModel,
32
  OpenAIServerModel,
33
- TransformersModel,
34
- GoogleSearchTool,
35
  Tool,
 
36
  )
37
- from smolagents.agent_types import AgentText, AgentImage, AgentAudio
38
- from smolagents.gradio_ui import pull_messages_from_step, handle_agent_output_types
39
 
40
  # ------------------------ Configuration and Setup ------------------------
41
  # Constants and configurations
@@ -144,13 +142,13 @@ class ModelManager:
144
  if chosen_inference == "hf_api":
145
  return HfApiModel(model_id=model_id)
146
 
147
- elif chosen_inference == "hf_api_provider":
148
  return HfApiModel(provider="together")
149
 
150
- elif chosen_inference == "litellm":
151
  return LiteLLMModel(model_id=model_id)
152
 
153
- elif chosen_inference == "openai":
154
  if not key_manager:
155
  raise ValueError("Key manager required for OpenAI model")
156
 
 
7
  import shutil
8
  from typing import Optional
9
 
10
+ import gradio as gr
11
  from dotenv import load_dotenv
12
  from huggingface_hub import login
13
+ from scripts.flux_lora_tool import FluxLoRATool
14
+ from scripts.text_cleaner_tool import TextCleanerTool
15
  from scripts.text_inspector_tool import TextInspectorTool
16
  from scripts.text_web_browser import (
17
  ArchiveSearchTool,
 
23
  VisitTool,
24
  )
25
  from scripts.visual_qa import visualizer
 
 
 
26
  from smolagents import (
27
  CodeAgent,
28
+ GoogleSearchTool,
29
  HfApiModel,
30
  LiteLLMModel,
31
  OpenAIServerModel,
 
 
32
  Tool,
33
+ TransformersModel,
34
  )
35
+ from smolagents.agent_types import AgentAudio, AgentImage, AgentText
36
+ from smolagents.gradio_ui import handle_agent_output_types, pull_messages_from_step
37
 
38
  # ------------------------ Configuration and Setup ------------------------
39
  # Constants and configurations
 
142
  if chosen_inference == "hf_api":
143
  return HfApiModel(model_id=model_id)
144
 
145
+ if chosen_inference == "hf_api_provider":
146
  return HfApiModel(provider="together")
147
 
148
+ if chosen_inference == "litellm":
149
  return LiteLLMModel(model_id=model_id)
150
 
151
+ if chosen_inference == "openai":
152
  if not key_manager:
153
  raise ValueError("Key manager required for OpenAI model")
154