Commit
·
f35ac3c
1
Parent(s):
8a35b07
Update app.py
Browse files
app.py
CHANGED
@@ -21,6 +21,11 @@ import dotenv
|
|
21 |
from dotenv import load_dotenv
|
22 |
load_dotenv()
|
23 |
|
|
|
|
|
|
|
|
|
|
|
24 |
# %% ../drive/MyDrive/Codici/Python/Apps/Gradio_App/Langchain_apps/langchain_summarization_app.ipynb 5
|
25 |
hub_llm = HuggingFaceHub(
|
26 |
repo_id="facebook/bart-large-cnn", # facebook/bart-large-cnn or "google/flan-t5-base" or "google/pegasus-xsum"
|
@@ -32,6 +37,7 @@ hub_llm = HuggingFaceHub(
|
|
32 |
"top_k": 50, # Consider only the top k most likely tokens when generating
|
33 |
"top_p": 0.95, # Consider tokens with cumulative probability up to top_p
|
34 |
"early_stopping": True, # Stops generation when a certain condition is met (e.g., end-of-sequence token)
|
|
|
35 |
}
|
36 |
)
|
37 |
|
|
|
21 |
from dotenv import load_dotenv
|
22 |
load_dotenv()
|
23 |
|
24 |
+
# Ensure the API token is set
|
25 |
+
huggingfacehub_api_token = os.getenv('HUGGINGFACEHUB_API_TOKEN')
|
26 |
+
if not huggingfacehub_api_token:
|
27 |
+
raise ValueError("Please set the HUGGINGFACEHUB_API_TOKEN environment variable.")
|
28 |
+
|
29 |
# %% ../drive/MyDrive/Codici/Python/Apps/Gradio_App/Langchain_apps/langchain_summarization_app.ipynb 5
|
30 |
hub_llm = HuggingFaceHub(
|
31 |
repo_id="facebook/bart-large-cnn", # facebook/bart-large-cnn or "google/flan-t5-base" or "google/pegasus-xsum"
|
|
|
37 |
"top_k": 50, # Consider only the top k most likely tokens when generating
|
38 |
"top_p": 0.95, # Consider tokens with cumulative probability up to top_p
|
39 |
"early_stopping": True, # Stops generation when a certain condition is met (e.g., end-of-sequence token)
|
40 |
+
"huggingfacehub_api_token": huggingfacehub_api_token
|
41 |
}
|
42 |
)
|
43 |
|