savi8sant8s commited on
Commit
98fd32e
·
1 Parent(s): e313767

Added huggingface inference configuration

Browse files
Files changed (3) hide show
  1. README.md +3 -0
  2. app.py +9 -1
  3. requirements.txt +2 -1
README.md CHANGED
@@ -9,6 +9,9 @@ app_file: app.py
9
  pinned: false
10
  license: apache-2.0
11
  short_description: Generate PlantUML diagrams from natural language description
 
 
 
12
  ---
13
 
14
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
9
  pinned: false
10
  license: apache-2.0
11
  short_description: Generate PlantUML diagrams from natural language description
12
+ hf_oauth: true
13
+ hf_oauth_scopes:
14
+ - inference-api
15
  ---
16
 
17
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py CHANGED
@@ -5,15 +5,23 @@ from src.retriever_tool import RetrieverTool
5
  from src.plantuml import render_plantuml
6
  from src.examples import get_plantuml_examples
7
  import re
 
 
 
 
 
 
8
 
9
  PDF_PATH = "PlantUML_Language_Reference_Guide_en.pdf"
10
 
11
  docs_processed = get_processed_documents(PDF_PATH)
12
  retriever_tool = RetrieverTool(docs_processed)
13
 
 
 
14
  agent = CodeAgent(
15
  tools=[retriever_tool],
16
- model=InferenceClientModel('microsoft/phi-4'),
17
  max_steps=4,
18
  verbosity_level=2,
19
  )
 
5
  from src.plantuml import render_plantuml
6
  from src.examples import get_plantuml_examples
7
  import re
8
+ from dotenv import load_dotenv
9
+ import os
10
+
11
+ load_dotenv()
12
+
13
+ user_token = os.getenv("HF_TOKEN")
14
 
15
  PDF_PATH = "PlantUML_Language_Reference_Guide_en.pdf"
16
 
17
  docs_processed = get_processed_documents(PDF_PATH)
18
  retriever_tool = RetrieverTool(docs_processed)
19
 
20
+ model = InferenceClientModel('microsoft/phi-4', api_key=user_token)
21
+
22
  agent = CodeAgent(
23
  tools=[retriever_tool],
24
+ model=model,
25
  max_steps=4,
26
  verbosity_level=2,
27
  )
requirements.txt CHANGED
@@ -6,4 +6,5 @@ smolagents
6
  smolagents[gradio]
7
  plantweb
8
  rank_bm25
9
- numpy==1.26.4
 
 
6
  smolagents[gradio]
7
  plantweb
8
  rank_bm25
9
+ numpy==1.26.4
10
+ python-dotenv