ibrahim313 commited on
Commit
a75c882
·
verified ·
1 Parent(s): 5b03873

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -9
app.py CHANGED
@@ -7,16 +7,13 @@ from gtts import gTTS
7
  import tempfile
8
  import whisper
9
 
10
- # Set the API key for Groq
11
- api_key = "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"
12
- os.environ["GROQ_API_KEY"] = api_key
 
13
 
14
- # Initialize Groq client with API key from environment variable
15
- api_key = os.getenv("GROQ_API_KEY")
16
- if not api_key:
17
- raise ValueError("API key for Groq is not set. Please set the environment variable GROQ_API_KEY.")
18
 
19
- client = Groq(api_key=api_key)
20
 
21
  # Load Whisper model
22
  model = whisper.load_model("base")
@@ -58,7 +55,7 @@ iface = gr.Interface(
58
  outputs=[gr.Textbox(label="Summary"), gr.Audio(label="Audio Summary")],
59
  title="Document Summarizer",
60
  description="Upload a Word or PDF document and get a summary with audio playback.",
61
- theme=gr.themes.Monochrome() # Apply Monochrome theme
62
  )
63
 
64
  # Launch the interface with sharing enabled
 
7
  import tempfile
8
  import whisper
9
 
10
+ # Load Groq API key from environment variable
11
+ groq_api_key = os.getenv('GROQ_API_KEY')
12
+ if not groq_api_key:
13
+ raise ValueError("GROQ_API_KEY environment variable is not set.")
14
 
15
+ groq_client = Groq(api_key=groq_api_key)
 
 
 
16
 
 
17
 
18
  # Load Whisper model
19
  model = whisper.load_model("base")
 
55
  outputs=[gr.Textbox(label="Summary"), gr.Audio(label="Audio Summary")],
56
  title="Document Summarizer",
57
  description="Upload a Word or PDF document and get a summary with audio playback.",
58
+ theme=gr.themes.Monochrome()
59
  )
60
 
61
  # Launch the interface with sharing enabled