Skip to content

Python scraper based on AI

Merge pull request #60 from VinciGit00/huggingface_integration

Marco Perinidde9eeec879f
diff --cc scrapegraphai/graphs/abstract_graph.py
index 5bc79a6d,ca4fc65c..5f7a08e7
--- a/scrapegraphai/graphs/abstract_graph.py
+++ b/scrapegraphai/graphs/abstract_graph.py
@@@ -3,9 -3,10 +3,9 @@@ Module having abstract class for creati
"""
from abc import ABC, abstractmethod
from typing import Optional
- from ..models import OpenAI, Gemini, Ollama, AzureOpenAI
+ from ..models import OpenAI, Gemini, Ollama, AzureOpenAI, HuggingFace
from ..helpers import models_tokens
-
class AbstractGraph(ABC):
"""
Abstract class representing a generic graph-based tool.
@@@ -81,16 -71,16 +73,22 @@@
raise ValueError("Model not supported")
return Ollama(llm_params)
-
+ elif "hugging_face" in llm_params["model"]:
+ try:
+ self.model_token = models_tokens["hugging_face"][llm_params["model"]]
+ except KeyError:
+ raise ValueError("Model not supported")
+ return HuggingFace(llm_params)
else:
- raise ValueError("Model not supported")
+ raise ValueError(
+ "Model provided by the configuration not supported")
+ def get_execution_info(self):
+ """
+ Returns the execution information of the graph.
+ """
+ return self.execution_info
+
@abstractmethod
def _create_graph(self):
"""