skjaini commited on
Commit
9b6341d
·
verified ·
1 Parent(s): d9259e4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -8
app.py CHANGED
@@ -2,7 +2,7 @@ import streamlit as st
2
  from crewai import Crew, Agent, Task, Process
3
  from langchain_core.tools import Tool
4
  from langchain_community.tools import DuckDuckGoSearchRun
5
- from langchain_community.llms import HuggingFaceEndpoint # Changed to HuggingFaceEndpoint
6
  import datetime
7
  import os
8
 
@@ -44,10 +44,12 @@ def create_ai_news_crew():
44
  verbose=True,
45
  allow_delegation=False,
46
  tools=[search_tool],
47
- llm=HuggingFaceEndpoint( # Use HuggingFaceEndpoint
48
- endpoint_url="https://api-inference.huggingface.co/models/deepseek-ai/DeepSeek-Coder-33B-Instruct", #Use correct end point
49
  task="text-generation",
50
- model_kwargs={"temperature": 0.5, "max_new_tokens": 1024, "repetition_penalty": 1.2},
 
 
51
  huggingfacehub_api_token=huggingfacehub_api_token,
52
  )
53
  )
@@ -61,10 +63,12 @@ def create_ai_news_crew():
61
  on AI developments quickly.""",
62
  verbose=True,
63
  allow_delegation=False,
64
- llm=HuggingFaceEndpoint( # Use HuggingFaceEndpoint
65
- endpoint_url="https://api-inference.huggingface.co/models/deepseek-ai/DeepSeek-Coder-33B-Instruct", #Use correct endpoint
66
  task="text-generation",
67
- model_kwargs={"temperature": 0.2, "max_new_tokens": 1024, "repetition_penalty": 1.2},
 
 
68
  huggingfacehub_api_token=huggingfacehub_api_token,
69
  )
70
  )
@@ -126,7 +130,7 @@ def main():
126
 
127
  except Exception as e:
128
  st.error(f"An error occurred: {e}")
129
- st.error("Please check your API key, endpoint URL and ensure you have set up the environment correctly.") #Added endpoint url check
130
 
131
 
132
  if __name__ == "__main__":
 
2
  from crewai import Crew, Agent, Task, Process
3
  from langchain_core.tools import Tool
4
  from langchain_community.tools import DuckDuckGoSearchRun
5
+ from langchain_community.llms import HuggingFaceEndpoint
6
  import datetime
7
  import os
8
 
 
44
  verbose=True,
45
  allow_delegation=False,
46
  tools=[search_tool],
47
+ llm=HuggingFaceEndpoint(
48
+ endpoint_url="https://api-inference.huggingface.co/models/deepseek-ai/DeepSeek-Coder-33B-Instruct",
49
  task="text-generation",
50
+ temperature=0.5, # Pass parameters explicitly
51
+ max_new_tokens=1024, # Pass parameters explicitly
52
+ repetition_penalty=1.2, # Pass parameters explicitly
53
  huggingfacehub_api_token=huggingfacehub_api_token,
54
  )
55
  )
 
63
  on AI developments quickly.""",
64
  verbose=True,
65
  allow_delegation=False,
66
+ llm=HuggingFaceEndpoint(
67
+ endpoint_url="https://api-inference.huggingface.co/models/deepseek-ai/DeepSeek-Coder-33B-Instruct",
68
  task="text-generation",
69
+ temperature=0.2, # Pass parameters explicitly
70
+ max_new_tokens=1024, # Pass parameters explicitly
71
+ repetition_penalty=1.2, # Pass parameters explicitly
72
  huggingfacehub_api_token=huggingfacehub_api_token,
73
  )
74
  )
 
130
 
131
  except Exception as e:
132
  st.error(f"An error occurred: {e}")
133
+ st.error("Please check your API key, endpoint URL and ensure you have set up the environment correctly.")
134
 
135
 
136
  if __name__ == "__main__":