desolo-2918 commited on
Commit
9c168f5
·
verified ·
1 Parent(s): 6a11abe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -8
app.py CHANGED
@@ -4,13 +4,20 @@ from huggingface_hub import hf_hub_download
4
  import os
5
 
6
  # 1. Configuration & Auto-Download
7
- # Filename MUST be lowercase to match the tiiuae repository
8
- MODEL_PATH = hf_hub_download(
9
- repo_id="tiiuae/Falcon3-1B-Instruct-GGUF",
10
- filename="falcon3-1b-instruct-q4_k_m.gguf"
11
- )
 
 
 
 
 
 
 
12
 
13
- # Initialize the Falcon model engine using the downloaded path
14
  falcon_ai = Llama(
15
  model_path=MODEL_PATH,
16
  n_ctx=2048,
@@ -22,7 +29,6 @@ def generate_falcon_ppt(topic, num_slides):
22
  if not topic:
23
  return "Please enter a topic to begin."
24
 
25
- # Falcon3 specific instruction format
26
  prompt = f"""<|system|>
27
  You are an expert presentation designer. Create a PowerPoint script with EXACTLY {num_slides} slides.
28
  For each slide, include a Title, Bullet Points, and Speaker Notes.
@@ -32,7 +38,6 @@ Number of Slides: {num_slides}
32
  <|assistant|>
33
  """
34
 
35
- # Generate the response from Falcon
36
  output = falcon_ai(
37
  prompt,
38
  max_tokens=1500,
 
4
  import os
5
 
6
  # 1. Configuration & Auto-Download
7
+ # The exact filename in the tiiuae repo is Falcon3-1B-Instruct-Q4_K_M.gguf
8
+ try:
9
+ MODEL_PATH = hf_hub_download(
10
+ repo_id="tiiuae/Falcon3-1B-Instruct-GGUF",
11
+ filename="Falcon3-1B-Instruct-Q4_K_M.gguf"
12
+ )
13
+ except Exception:
14
+ # Fallback in case of further naming discrepancies
15
+ MODEL_PATH = hf_hub_download(
16
+ repo_id="tiiuae/Falcon3-1B-Instruct-GGUF",
17
+ filename="falcon3-1b-instruct-q4_k_m.gguf"
18
+ )
19
 
20
+ # Initialize the Falcon model engine
21
  falcon_ai = Llama(
22
  model_path=MODEL_PATH,
23
  n_ctx=2048,
 
29
  if not topic:
30
  return "Please enter a topic to begin."
31
 
 
32
  prompt = f"""<|system|>
33
  You are an expert presentation designer. Create a PowerPoint script with EXACTLY {num_slides} slides.
34
  For each slide, include a Title, Bullet Points, and Speaker Notes.
 
38
  <|assistant|>
39
  """
40
 
 
41
  output = falcon_ai(
42
  prompt,
43
  max_tokens=1500,