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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -14
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
6
  import datetime
7
  import os
8
 
@@ -44,12 +44,9 @@ def create_ai_news_crew():
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,12 +60,9 @@ def create_ai_news_crew():
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,7 +124,7 @@ def main():
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__":
 
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 HuggingFaceHub # Change back to HuggingFaceHub
6
  import datetime
7
  import os
8
 
 
44
  verbose=True,
45
  allow_delegation=False,
46
  tools=[search_tool],
47
+ llm=HuggingFaceHub( # Use HuggingFaceHub
48
+ repo_id="deepseek-ai/DeepSeek-Coder-33B-Instruct", #Specify the model
49
+ model_kwargs={"temperature": 0.5, "max_new_tokens": 1024, "repetition_penalty": 1.2}, # Add model parameters here
 
 
 
50
  huggingfacehub_api_token=huggingfacehub_api_token,
51
  )
52
  )
 
60
  on AI developments quickly.""",
61
  verbose=True,
62
  allow_delegation=False,
63
+ llm=HuggingFaceHub( # Use HuggingFaceHub
64
+ repo_id="deepseek-ai/DeepSeek-Coder-33B-Instruct", #Specify model
65
+ model_kwargs={"temperature": 0.2, "max_new_tokens": 1024, "repetition_penalty": 1.2}, #Add model parameters here
 
 
 
66
  huggingfacehub_api_token=huggingfacehub_api_token,
67
  )
68
  )
 
124
 
125
  except Exception as e:
126
  st.error(f"An error occurred: {e}")
127
+ st.error("Please check your API key, and ensure you have set up the environment correctly.")
128
 
129
 
130
  if __name__ == "__main__":