MariaFilipkowska commited on
Commit
a82d0be
·
verified ·
1 Parent(s): 2eed524

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -8
app.py CHANGED
@@ -4,24 +4,22 @@ import gradio as gr
4
  import requests
5
  import pandas as pd
6
  import base64
7
- import ollama
8
 
9
 
10
  from typing import TypedDict, Annotated
11
  from langchain_core.messages import AnyMessage, SystemMessage, HumanMessage
12
  from langchain_community.tools import DuckDuckGoSearchRun
13
- from langchain_ollama import ChatOllama
14
  from langchain.tools import Tool
15
  from langgraph.graph import START, StateGraph
16
  from langgraph.graph.message import add_messages
17
  from langgraph.prebuilt import ToolNode, tools_condition
18
-
 
19
 
20
  print("Loading LLM...")
21
- ollama.pull('gemma:7b')
22
- chat = ChatOllama(model='gemma:7b', verbose=True)
23
  print(f"Model {chat.model} downloaded!")
24
- from huggingface_hub import login, InferenceClient
25
 
26
  # (Keep Constants as is)
27
  # --- Constants ---
@@ -91,8 +89,6 @@ extract_text_tool = Tool(
91
  description="Retrieves text from an image."
92
  )
93
 
94
-
95
- chat = ChatHuggingFace(llm=llm, verbose=True)
96
  print(f"Model {chat.llm} downloaded!")
97
 
98
  tools = [get_file_path_tool, get_content_tool]
 
4
  import requests
5
  import pandas as pd
6
  import base64
 
7
 
8
 
9
  from typing import TypedDict, Annotated
10
  from langchain_core.messages import AnyMessage, SystemMessage, HumanMessage
11
  from langchain_community.tools import DuckDuckGoSearchRun
 
12
  from langchain.tools import Tool
13
  from langgraph.graph import START, StateGraph
14
  from langgraph.graph.message import add_messages
15
  from langgraph.prebuilt import ToolNode, tools_condition
16
+ from huggingface_hub import InferenceClient
17
+ from langchain.chat_models import init_chat_model
18
 
19
  print("Loading LLM...")
20
+ client = InferenceClient("meta-llama/Llama-3.3-70B-Instruct")
21
+ chat = init_chat_model("meta-llama/Llama-3.3-70B-Instruct")
22
  print(f"Model {chat.model} downloaded!")
 
23
 
24
  # (Keep Constants as is)
25
  # --- Constants ---
 
89
  description="Retrieves text from an image."
90
  )
91
 
 
 
92
  print(f"Model {chat.llm} downloaded!")
93
 
94
  tools = [get_file_path_tool, get_content_tool]