Manavraj commited on
Commit
a3f7cf5
·
verified ·
1 Parent(s): d8af42f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -9
app.py CHANGED
@@ -1,13 +1,30 @@
1
  import gradio as gr
2
- from huggingface_hub import InferenceClient
 
3
 
4
- """
5
- For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
6
- """
7
- client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
8
 
 
 
 
 
 
 
 
 
 
 
 
 
9
 
10
- def respond(
 
 
 
 
 
 
 
 
11
  message,
12
  history: list[tuple[str, str]],
13
  system_message,
@@ -40,9 +57,7 @@ def respond(
40
  yield response
41
 
42
 
43
- """
44
- For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
45
- """
46
  demo = gr.ChatInterface(
47
  respond,
48
  additional_inputs=[
@@ -62,3 +77,4 @@ demo = gr.ChatInterface(
62
 
63
  if __name__ == "__main__":
64
  demo.launch()
 
 
1
  import gradio as gr
2
+ #from huggingface_hub import InferenceClient
3
+ from smolagents import CodeAgent, Tool
4
 
 
 
 
 
5
 
6
+ #client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
7
+
8
+ # Initialize the agent
9
+ agent = CodeAgent(
10
+ tools=[search_kb_tool, search_web_tool, format_response_tool],
11
+ system_prompt="""
12
+ You are a Basic Troubleshooting Assistant.
13
+ Understand the user's problem, attempt to resolve it using the knowledge base.
14
+ If the knowledge base is insufficient, perform a web search.
15
+ Provide clear, step-by-step instructions and confirm each step's outcome.
16
+ """
17
+ )
18
 
19
+ # Run the agent
20
+ while True:
21
+ user_input = input("User: ")
22
+ if user_input.lower() in ["exit", "quit"]:
23
+ break
24
+ response = agent.run(user_input)
25
+ print("Agent:", response)
26
+ ###############################################################
27
+ """def respond(
28
  message,
29
  history: list[tuple[str, str]],
30
  system_message,
 
57
  yield response
58
 
59
 
60
+
 
 
61
  demo = gr.ChatInterface(
62
  respond,
63
  additional_inputs=[
 
77
 
78
  if __name__ == "__main__":
79
  demo.launch()
80
+ """