Update app.py
Browse files
app.py
CHANGED
|
@@ -92,9 +92,16 @@ def summarize_text(summarizer_pipeline, text: str) -> str:
|
|
| 92 |
return out[0]["summary_text"].strip()
|
| 93 |
|
| 94 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
def run_pipeline(video_file: str) -> list[dict]:
|
| 96 |
# ββ Authenticate with HuggingFace Hub ββ
|
| 97 |
-
|
|
|
|
|
|
|
|
|
|
| 98 |
|
| 99 |
# ββ Build your pipelines ββ
|
| 100 |
asr = pipeline(
|
|
@@ -152,6 +159,7 @@ def run_pipeline(video_file: str) -> list[dict]:
|
|
| 152 |
return timeline
|
| 153 |
|
| 154 |
|
|
|
|
| 155 |
# βββ Gradio UI βββ
|
| 156 |
demo = gr.Blocks()
|
| 157 |
with demo:
|
|
|
|
| 92 |
return out[0]["summary_text"].strip()
|
| 93 |
|
| 94 |
|
| 95 |
+
from dotenv import load_dotenv
|
| 96 |
+
|
| 97 |
+
load_dotenv() # Optional: Load .env file if it exists
|
| 98 |
+
|
| 99 |
def run_pipeline(video_file: str) -> list[dict]:
|
| 100 |
# ββ Authenticate with HuggingFace Hub ββ
|
| 101 |
+
hf_token = os.getenv("HF_TOKEN")
|
| 102 |
+
if not hf_token:
|
| 103 |
+
raise EnvironmentError("HF_TOKEN environment variable is not set.")
|
| 104 |
+
login(token=hf_token)
|
| 105 |
|
| 106 |
# ββ Build your pipelines ββ
|
| 107 |
asr = pipeline(
|
|
|
|
| 159 |
return timeline
|
| 160 |
|
| 161 |
|
| 162 |
+
|
| 163 |
# βββ Gradio UI βββ
|
| 164 |
demo = gr.Blocks()
|
| 165 |
with demo:
|