seiching commited on
Commit
b7ba5fb
1 Parent(s): 7eb7423

add hugapikey management

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -2,7 +2,9 @@ import torch
2
  from transformers import pipeline
3
  from transformers.pipelines.audio_utils import ffmpeg_read
4
  import gradio as gr
 
5
 
 
6
  MODEL_NAME = "seiching/whisper-small-seiching"
7
  #MODEL_NAME = "openai/whisper-small"
8
  BATCH_SIZE = 8
@@ -55,8 +57,13 @@ def process_chunks(openaikeystr,inputtext):
55
 
56
  # api_key=openaikeystr,
57
  # )
 
 
 
 
 
58
  #openaiojb =OpenAI(base_url="http://localhost:1234/v1", api_key="not-needed")
59
- openaiobj =OpenAI( api_key=openaikeystr)
60
  text = inputtext
61
  #openaikey.set_key(openaikeystr)
62
  #print('process_chunk',openaikey.get_key())
 
2
  from transformers import pipeline
3
  from transformers.pipelines.audio_utils import ffmpeg_read
4
  import gradio as gr
5
+ import os
6
 
7
+ hugapikey=os.environ['openaikey']
8
  MODEL_NAME = "seiching/whisper-small-seiching"
9
  #MODEL_NAME = "openai/whisper-small"
10
  BATCH_SIZE = 8
 
57
 
58
  # api_key=openaikeystr,
59
  # )
60
+ if hugapikey!='test':
61
+ realkey=openaikeystr
62
+ else:
63
+ realkey=hugapikey
64
+
65
  #openaiojb =OpenAI(base_url="http://localhost:1234/v1", api_key="not-needed")
66
+ openaiobj =OpenAI( api_key=realkey)
67
  text = inputtext
68
  #openaikey.set_key(openaikeystr)
69
  #print('process_chunk',openaikey.get_key())