lochn commited on
Commit
b5c2ea7
Β·
verified Β·
1 Parent(s): f011c3e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -1
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
- login(token=HF_TOKEN)
 
 
 
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: