Spaces:
Sleeping
Sleeping
testing , logging
#34
by
adithyagv
- opened
- Gradio_UI.py +26 -0
Gradio_UI.py
CHANGED
@@ -23,8 +23,31 @@ from smolagents.agent_types import AgentAudio, AgentImage, AgentText, handle_age
|
|
23 |
from smolagents.agents import ActionStep, MultiStepAgent
|
24 |
from smolagents.memory import MemoryStep
|
25 |
from smolagents.utils import _is_package_available
|
|
|
|
|
|
|
26 |
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
def pull_messages_from_step(
|
29 |
step_log: MemoryStep,
|
30 |
):
|
@@ -292,4 +315,7 @@ class GradioUI:
|
|
292 |
demo.launch(debug=True, share=True, **kwargs)
|
293 |
|
294 |
|
|
|
|
|
|
|
295 |
__all__ = ["stream_to_gradio", "GradioUI"]
|
|
|
23 |
from smolagents.agents import ActionStep, MultiStepAgent
|
24 |
from smolagents.memory import MemoryStep
|
25 |
from smolagents.utils import _is_package_available
|
26 |
+
import gradio as gr
|
27 |
+
from smolagents.agents.agent_output_parser import ChatMessage
|
28 |
+
from Gradio_UI import stream_to_gradio
|
29 |
|
30 |
|
31 |
+
import logging
|
32 |
+
|
33 |
+
# Configure logging (do this once, ideally at the top of your file)
|
34 |
+
logging.basicConfig(level=logging.DEBUG, # Set the logging level to capture detailed information
|
35 |
+
format='%(asctime)s - %(levelname)s - %(message)s')
|
36 |
+
|
37 |
+
|
38 |
+
def interact_with_agent(self, prompt, stored_messages):
|
39 |
+
logging.debug(f"Type of prompt in interact_with_agent: {type(prompt)}")
|
40 |
+
logging.debug(f"Value of prompt in interact_with_agent: {prompt}")
|
41 |
+
|
42 |
+
# ... rest of your interact_with_agent code ...
|
43 |
+
|
44 |
+
|
45 |
+
def log_user_message(self, text_input, file_uploads_log):
|
46 |
+
message = # ... your existing code to create the message ...
|
47 |
+
logging.debug(f"Type of message in log_user_message: {type(message)}")
|
48 |
+
logging.debug(f"Value of message in log_user_message: {message}")
|
49 |
+
return message, None
|
50 |
+
|
51 |
def pull_messages_from_step(
|
52 |
step_log: MemoryStep,
|
53 |
):
|
|
|
315 |
demo.launch(debug=True, share=True, **kwargs)
|
316 |
|
317 |
|
318 |
+
|
319 |
+
|
320 |
+
|
321 |
__all__ = ["stream_to_gradio", "GradioUI"]
|