tonko22 commited on
Commit
f709e28
·
1 Parent(s): 26dfe2c

More setup to app

Browse files
Files changed (2) hide show
  1. app.py +15 -9
  2. config.py +0 -28
app.py CHANGED
@@ -32,7 +32,7 @@ def main():
32
 
33
  # use_local = os.environ.get('SPACE_ID') is None
34
  use_local_llm = False
35
- use_localhost = True
36
 
37
  # If using Ollama, we need to specify the API base URL
38
  # Initialize the LLM model based on configuration
@@ -58,14 +58,20 @@ def main():
58
  gradio_config = get_gradio_config(use_localhost=use_localhost)
59
 
60
  # Инструкции агенту настраиваются непосредственно в GradioUI.py
61
-
62
- # Launch with appropriate configuration
63
- launch_kwargs = {
64
- "debug": gradio_config["debug"],
65
- "share": gradio_config["share"],
66
- "server_name": gradio_config["server_name"],
67
- "server_port": gradio_config["server_port"]
68
- }
 
 
 
 
 
 
69
 
70
  # Передаем инструкцию в конструктор GradioUI
71
  GradioUI(single_agent).launch(**launch_kwargs)
 
32
 
33
  # use_local = os.environ.get('SPACE_ID') is None
34
  use_local_llm = False
35
+ use_localhost = False
36
 
37
  # If using Ollama, we need to specify the API base URL
38
  # Initialize the LLM model based on configuration
 
58
  gradio_config = get_gradio_config(use_localhost=use_localhost)
59
 
60
  # Инструкции агенту настраиваются непосредственно в GradioUI.py
61
+ if use_localhost:
62
+ launch_kwargs = {
63
+ "debug": True,
64
+ "share": False,
65
+ "server_name": "127.0.0.1",
66
+ "server_port": 3000
67
+ }
68
+ else:
69
+ # Configuration for production (HuggingFace)
70
+ launch_kwargs = {
71
+ "debug": True,
72
+ "share": False
73
+ # No server_name or server_port for HuggingFace deployment
74
+ }
75
 
76
  # Передаем инструкцию в конструктор GradioUI
77
  GradioUI(single_agent).launch(**launch_kwargs)
config.py CHANGED
@@ -67,31 +67,3 @@ SEARCH_TOOL_CONFIG = {
67
  "min_delay": 3.0,
68
  "max_delay": 7.0
69
  }
70
-
71
-
72
- # Gradio UI configuration
73
- def get_gradio_config(use_localhost=True):
74
- """Get the appropriate Gradio UI configuration based on environment.
75
-
76
- Args:
77
- is_test: If True, use test configuration (local development).
78
- If False, use production configuration (HuggingFace).
79
-
80
- Returns:
81
- Dictionary with Gradio configuration parameters.
82
- """
83
- if use_localhost:
84
- # Configuration for local development/testing
85
- return {
86
- "debug": True,
87
- "share": False,
88
- "server_name": "127.0.0.1",
89
- "server_port": 3000
90
- }
91
- else:
92
- # Configuration for production (HuggingFace)
93
- return {
94
- "debug": True,
95
- "share": False
96
- # No server_name or server_port for HuggingFace deployment
97
- }
 
67
  "min_delay": 3.0,
68
  "max_delay": 7.0
69
  }