avans06 commited on
Commit
f9216c5
1 Parent(s): f7c9c25

Upgrade the project's Gradio version to 5.0.2.

Browse files
README.md CHANGED
@@ -4,7 +4,7 @@ emoji: ✨
4
  colorFrom: blue
5
  colorTo: purple
6
  sdk: gradio
7
- sdk_version: 3.50.2
8
  app_file: app.py
9
  pinned: false
10
  license: apache-2.0
 
4
  colorFrom: blue
5
  colorTo: purple
6
  sdk: gradio
7
+ sdk_version: 5.0.2
8
  app_file: app.py
9
  pinned: false
10
  license: apache-2.0
app.py CHANGED
@@ -451,9 +451,10 @@ class WhisperTranscriber:
451
 
452
  download.insert(0, downloadAllPath)
453
 
454
- filterLogText = [gr.Text.update(visible=False)]
455
  if filterLogs:
456
- filterLogText = [gr.Text.update(visible=True, value=filterLogs)]
 
457
 
458
  return [download, text, vtt] + filterLogText
459
 
@@ -1035,36 +1036,36 @@ def create_ui(app_config: ApplicationConfig):
1035
  madlad400_models = list(filter(lambda madlad400: "ct2" in madlad400, madlad400_models))
1036
 
1037
  common_whisper_inputs = lambda : {
1038
- gr.Dropdown(label="Whisper - Model (for audio)", choices=whisper_models, value=app_config.default_model_name, elem_id="whisperModelName"),
1039
- gr.Dropdown(label="Whisper - Language", choices=sorted(get_lang_whisper_names()), value=app_config.language, elem_id="whisperLangName"),
1040
  }
1041
  common_m2m100_inputs = lambda : {
1042
- gr.Dropdown(label="M2M100 - Model (for translate)", choices=m2m100_models, elem_id="m2m100ModelName"),
1043
- gr.Dropdown(label="M2M100 - Language", choices=sorted(get_lang_m2m100_names()), elem_id="m2m100LangName"),
1044
  }
1045
  common_nllb_inputs = lambda : {
1046
- gr.Dropdown(label="NLLB - Model (for translate)", choices=nllb_models, elem_id="nllbModelName"),
1047
- gr.Dropdown(label="NLLB - Language", choices=sorted(get_lang_nllb_names()), elem_id="nllbLangName"),
1048
  }
1049
  common_mt5_inputs = lambda : {
1050
- gr.Dropdown(label="MT5 - Model (for translate)", choices=mt5_models, elem_id="mt5ModelName"),
1051
- gr.Dropdown(label="MT5 - Language", choices=sorted(get_lang_m2m100_names(["en", "ja", "zh"])), elem_id="mt5LangName"),
1052
  }
1053
  common_ALMA_inputs = lambda : {
1054
- gr.Dropdown(label="ALMA - Model (for translate)", choices=ALMA_models, elem_id="ALMAModelName"),
1055
- gr.Dropdown(label="ALMA - Language", choices=sort_lang_by_whisper_codes(["en", "de", "cs", "is", "ru", "zh", "ja"]), elem_id="ALMALangName"),
1056
  }
1057
  common_madlad400_inputs = lambda : {
1058
- gr.Dropdown(label="madlad400 - Model (for translate)", choices=madlad400_models, elem_id="madlad400ModelName"),
1059
- gr.Dropdown(label="madlad400 - Language", choices=sorted(get_lang_m2m100_names()), elem_id="madlad400LangName"),
1060
  }
1061
  common_seamless_inputs = lambda : {
1062
- gr.Dropdown(label="seamless - Model (for translate)", choices=seamless_models, elem_id="seamlessModelName"),
1063
- gr.Dropdown(label="seamless - Language", choices=sorted(get_lang_seamlessT_Tx_names()), elem_id="seamlessLangName"),
1064
  }
1065
  common_Llama_inputs = lambda : {
1066
- gr.Dropdown(label="Llama - Model (for translate)", choices=Llama_models, elem_id="LlamaModelName"),
1067
- gr.Dropdown(label="Llama - Language", choices=sorted(get_lang_m2m100_names()), elem_id="LlamaLangName"),
1068
  }
1069
 
1070
  common_translation_inputs = lambda : {
@@ -1131,8 +1132,10 @@ def create_ui(app_config: ApplicationConfig):
1131
 
1132
  def create_transcribe(uiDescription: str, isQueueMode: bool, isFull: bool = False):
1133
  with gr.Blocks() as transcribe:
1134
- translateInput = gr.State(value="m2m100", elem_id = "translateInput")
1135
- sourceInput = gr.State(value="urlData", elem_id = "sourceInput")
 
 
1136
  gr.Markdown(uiDescription)
1137
  with gr.Row():
1138
  with gr.Column():
@@ -1173,8 +1176,8 @@ def create_ui(app_config: ApplicationConfig):
1173
  inputDict.update({gr.Text(label="URL (YouTube, etc.)", elem_id = "urlData")})
1174
  with gr.Tab(label="Upload") as UploadTab:
1175
  inputDict.update({gr.File(label="Upload Files", file_count="multiple", elem_id = "multipleFiles")})
1176
- with gr.Tab(label="Microphone") as MicTab:
1177
- inputDict.update({gr.Audio(source="microphone", type="filepath", label="Microphone Input", elem_id = "microphoneData")})
1178
  UrlTab.select(fn=lambda: "urlData", inputs = [], outputs= [sourceInput] )
1179
  UploadTab.select(fn=lambda: "multipleFiles", inputs = [], outputs= [sourceInput] )
1180
  MicTab.select(fn=lambda: "microphoneData", inputs = [], outputs= [sourceInput] )
@@ -1232,7 +1235,7 @@ def create_ui(app_config: ApplicationConfig):
1232
  if readmeMd is not None:
1233
  with gr.Accordion("README.md", open=False):
1234
  gr.Markdown(readmeMd)
1235
-
1236
  inputDict.update({translateInput, sourceInput})
1237
  submitBtn.click(fn=ui.transcribe_entry_progress if isQueueMode else ui.transcribe_entry,
1238
  inputs=inputDict, outputs=outputs)
@@ -1241,7 +1244,8 @@ def create_ui(app_config: ApplicationConfig):
1241
 
1242
  def create_translation(isQueueMode: bool):
1243
  with gr.Blocks() as translation:
1244
- translateInput = gr.State(value="m2m100", elem_id = "translateInput")
 
1245
  with gr.Row():
1246
  with gr.Column():
1247
  submitBtn = gr.Button("Submit", variant="primary")
@@ -1276,7 +1280,7 @@ def create_ui(app_config: ApplicationConfig):
1276
  llamaTab.select(fn=lambda: "Llama", inputs = [], outputs= [translateInput] )
1277
  with gr.Column():
1278
  inputDict.update({
1279
- gr.Dropdown(label="Input - Language", choices=sorted(get_lang_whisper_names()), value=app_config.language, elem_id="inputLangName"),
1280
  gr.Text(lines=5, label="Input - Text", elem_id="inputText", elem_classes="scroll-show"),
1281
  })
1282
  with gr.Column():
@@ -1289,7 +1293,7 @@ def create_ui(app_config: ApplicationConfig):
1289
  if translateModelMd is not None:
1290
  with gr.Accordion("docs/translateModel.md", open=False):
1291
  gr.Markdown(translateModelMd)
1292
-
1293
  inputDict.update({translateInput})
1294
  submitBtn.click(fn=ui.translation_entry_progress if isQueueMode else ui.translation_entry,
1295
  inputs=inputDict, outputs=outputs)
@@ -1304,8 +1308,8 @@ def create_ui(app_config: ApplicationConfig):
1304
  demo = gr.TabbedInterface([simpleTranscribe, fullTranscribe, uiTranslation], tab_names=["Simple", "Full", "Translation"], css=css)
1305
 
1306
  # Queue up the demo
1307
- if is_queue_mode:
1308
- demo.queue(concurrency_count=app_config.queue_concurrency_count)
1309
  print("Queue mode enabled (concurrency count: " + str(app_config.queue_concurrency_count) + ")")
1310
  else:
1311
  print("Queue mode disabled - progress bars will not be shown.")
 
451
 
452
  download.insert(0, downloadAllPath)
453
 
454
+ filterLogText = [gr.Text(visible=False)] #[Gradio 5.x] AttributeError: type object 'Textbox' has no attribute 'update'
455
  if filterLogs:
456
+ filterLogText[0].visible = True
457
+ filterLogText[0].value = filterLogs
458
 
459
  return [download, text, vtt] + filterLogText
460
 
 
1036
  madlad400_models = list(filter(lambda madlad400: "ct2" in madlad400, madlad400_models))
1037
 
1038
  common_whisper_inputs = lambda : {
1039
+ gr.Dropdown(label="Whisper - Model (for audio)", choices=whisper_models, value=app_config.default_model_name if app_config.default_model_name != None else [], elem_id="whisperModelName"),
1040
+ gr.Dropdown(label="Whisper - Language", choices=sorted(get_lang_whisper_names()), value=app_config.language if app_config.language != None else [], elem_id="whisperLangName"),
1041
  }
1042
  common_m2m100_inputs = lambda : {
1043
+ gr.Dropdown(label="M2M100 - Model (for translate)", choices=m2m100_models, value=[], elem_id="m2m100ModelName"),
1044
+ gr.Dropdown(label="M2M100 - Language", choices=sorted(get_lang_m2m100_names()), value=[], elem_id="m2m100LangName"),
1045
  }
1046
  common_nllb_inputs = lambda : {
1047
+ gr.Dropdown(label="NLLB - Model (for translate)", choices=nllb_models, value=[], elem_id="nllbModelName"),
1048
+ gr.Dropdown(label="NLLB - Language", choices=sorted(get_lang_nllb_names()), value=[], elem_id="nllbLangName"),
1049
  }
1050
  common_mt5_inputs = lambda : {
1051
+ gr.Dropdown(label="MT5 - Model (for translate)", choices=mt5_models, value=[], elem_id="mt5ModelName"),
1052
+ gr.Dropdown(label="MT5 - Language", choices=sorted(get_lang_m2m100_names(["en", "ja", "zh"])), value=[], elem_id="mt5LangName"),
1053
  }
1054
  common_ALMA_inputs = lambda : {
1055
+ gr.Dropdown(label="ALMA - Model (for translate)", choices=ALMA_models, value=[], elem_id="ALMAModelName"),
1056
+ gr.Dropdown(label="ALMA - Language", choices=sort_lang_by_whisper_codes(["en", "de", "cs", "is", "ru", "zh", "ja"]), value=[], elem_id="ALMALangName"),
1057
  }
1058
  common_madlad400_inputs = lambda : {
1059
+ gr.Dropdown(label="madlad400 - Model (for translate)", choices=madlad400_models, value=[], elem_id="madlad400ModelName"),
1060
+ gr.Dropdown(label="madlad400 - Language", choices=sorted(get_lang_m2m100_names()), value=[], elem_id="madlad400LangName"),
1061
  }
1062
  common_seamless_inputs = lambda : {
1063
+ gr.Dropdown(label="seamless - Model (for translate)", choices=seamless_models, value=[], elem_id="seamlessModelName"),
1064
+ gr.Dropdown(label="seamless - Language", choices=sorted(get_lang_seamlessT_Tx_names()), value=[], elem_id="seamlessLangName"),
1065
  }
1066
  common_Llama_inputs = lambda : {
1067
+ gr.Dropdown(label="Llama - Model (for translate)", choices=Llama_models, value=[], elem_id="LlamaModelName"),
1068
+ gr.Dropdown(label="Llama - Language", choices=sorted(get_lang_m2m100_names()), value=[], elem_id="LlamaLangName"),
1069
  }
1070
 
1071
  common_translation_inputs = lambda : {
 
1132
 
1133
  def create_transcribe(uiDescription: str, isQueueMode: bool, isFull: bool = False):
1134
  with gr.Blocks() as transcribe:
1135
+ translateInput = gr.State(value="m2m100") # [Gradio 5.x] TypeError: State.__init__() got an unexpected keyword argument 'elem_id'
1136
+ sourceInput = gr.State(value="urlData")
1137
+ translateInput.elem_id = "translateInput"
1138
+ sourceInput.elem_id = "sourceInput"
1139
  gr.Markdown(uiDescription)
1140
  with gr.Row():
1141
  with gr.Column():
 
1176
  inputDict.update({gr.Text(label="URL (YouTube, etc.)", elem_id = "urlData")})
1177
  with gr.Tab(label="Upload") as UploadTab:
1178
  inputDict.update({gr.File(label="Upload Files", file_count="multiple", elem_id = "multipleFiles")})
1179
+ with gr.Tab(label="Microphone") as MicTab: # [Gradio 5.x] TypeError: Audio.__init__() got an unexpected keyword argument 'source'
1180
+ inputDict.update({gr.Audio(sources=["microphone"], type="filepath", label="Microphone Input", elem_id = "microphoneData")})
1181
  UrlTab.select(fn=lambda: "urlData", inputs = [], outputs= [sourceInput] )
1182
  UploadTab.select(fn=lambda: "multipleFiles", inputs = [], outputs= [sourceInput] )
1183
  MicTab.select(fn=lambda: "microphoneData", inputs = [], outputs= [sourceInput] )
 
1235
  if readmeMd is not None:
1236
  with gr.Accordion("README.md", open=False):
1237
  gr.Markdown(readmeMd)
1238
+
1239
  inputDict.update({translateInput, sourceInput})
1240
  submitBtn.click(fn=ui.transcribe_entry_progress if isQueueMode else ui.transcribe_entry,
1241
  inputs=inputDict, outputs=outputs)
 
1244
 
1245
  def create_translation(isQueueMode: bool):
1246
  with gr.Blocks() as translation:
1247
+ translateInput = gr.State(value="m2m100") # [Gradio 5.x] TypeError: State.__init__() got an unexpected keyword argument 'elem_id'
1248
+ translateInput.elem_id = "translateInput"
1249
  with gr.Row():
1250
  with gr.Column():
1251
  submitBtn = gr.Button("Submit", variant="primary")
 
1280
  llamaTab.select(fn=lambda: "Llama", inputs = [], outputs= [translateInput] )
1281
  with gr.Column():
1282
  inputDict.update({
1283
+ gr.Dropdown(label="Input - Language", choices=sorted(get_lang_whisper_names()), value=app_config.language if app_config.language != None else [], elem_id="inputLangName"),
1284
  gr.Text(lines=5, label="Input - Text", elem_id="inputText", elem_classes="scroll-show"),
1285
  })
1286
  with gr.Column():
 
1293
  if translateModelMd is not None:
1294
  with gr.Accordion("docs/translateModel.md", open=False):
1295
  gr.Markdown(translateModelMd)
1296
+
1297
  inputDict.update({translateInput})
1298
  submitBtn.click(fn=ui.translation_entry_progress if isQueueMode else ui.translation_entry,
1299
  inputs=inputDict, outputs=outputs)
 
1308
  demo = gr.TabbedInterface([simpleTranscribe, fullTranscribe, uiTranslation], tab_names=["Simple", "Full", "Translation"], css=css)
1309
 
1310
  # Queue up the demo
1311
+ if is_queue_mode: # [Gradio 5.x] TypeError: Blocks.queue() got an unexpected keyword argument 'concurrency_count'
1312
+ demo.queue(default_concurrency_limit=app_config.queue_concurrency_count)
1313
  print("Queue mode enabled (concurrency count: " + str(app_config.queue_concurrency_count) + ")")
1314
  else:
1315
  print("Queue mode disabled - progress bars will not be shown.")
config.json5 CHANGED
@@ -309,6 +309,12 @@
309
  "url": "avans06/Meta-Llama-3-8B-Instruct-ct2-int8_float16",
310
  "type": "huggingface",
311
  "tokenizer_url": "avans06/Meta-Llama-3-8B-Instruct-ct2-int8_float16"
 
 
 
 
 
 
312
  }
313
  ]
314
  },
 
309
  "url": "avans06/Meta-Llama-3-8B-Instruct-ct2-int8_float16",
310
  "type": "huggingface",
311
  "tokenizer_url": "avans06/Meta-Llama-3-8B-Instruct-ct2-int8_float16"
312
+ },
313
+ {
314
+ "name": "Meta-Llama-3.2-3B-Instruct-ct2-int8/jncraton",
315
+ "url": "jncraton/Llama-3.2-3B-Instruct-ct2-int8",
316
+ "type": "huggingface",
317
+ "tokenizer_url": "jncraton/Llama-3.2-3B-Instruct-ct2-int8"
318
  }
319
  ]
320
  },
requirements-fasterWhisper.txt CHANGED
@@ -1,8 +1,8 @@
1
- transformers
2
- ctranslate2>=4.2.1
3
- faster-whisper>=1.0.2
4
  ffmpeg-python==0.2.0
5
- gradio==3.50.2
6
  yt-dlp
7
  json5
8
  torch
 
1
+ transformers>=4.45.2
2
+ ctranslate2>=4.4.0
3
+ faster-whisper>=1.0.3
4
  ffmpeg-python==0.2.0
5
+ gradio==5.0.2
6
  yt-dlp
7
  json5
8
  torch
requirements-whisper.txt CHANGED
@@ -1,12 +1,13 @@
1
- transformers
2
- ctranslate2>=4.2.1
3
  git+https://github.com/openai/whisper.git
4
  ffmpeg-python==0.2.0
5
- gradio==3.50.2
6
  yt-dlp
 
 
7
  torchaudio
8
  altair
9
- json5
10
  zhconv
11
  sentencepiece
12
 
 
1
+ transformers>=4.45.2
2
+ ctranslate2>=4.4.0
3
  git+https://github.com/openai/whisper.git
4
  ffmpeg-python==0.2.0
5
+ gradio==5.0.2
6
  yt-dlp
7
+ json5
8
+ torch
9
  torchaudio
10
  altair
 
11
  zhconv
12
  sentencepiece
13
 
requirements.txt CHANGED
@@ -1,8 +1,8 @@
1
- transformers
2
- ctranslate2>=4.2.1
3
- faster-whisper>=1.0.2
4
  ffmpeg-python==0.2.0
5
- gradio==3.50.2
6
  yt-dlp
7
  json5
8
  torch
 
1
+ transformers>=4.45.2
2
+ ctranslate2>=4.4.0
3
+ faster-whisper>=1.0.3
4
  ffmpeg-python==0.2.0
5
+ gradio==5.0.2
6
  yt-dlp
7
  json5
8
  torch