Jiangxz01 commited on
Commit
b73035a
·
verified ·
1 Parent(s): f36044a

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -2
app.py CHANGED
@@ -291,7 +291,18 @@ with gr.Blocks(theme=gr.themes.Monochrome(), css=custom_css) as iface:
291
  ### ※ 自動生成 Podcast 節目及音檔,系統布署:江信宗,LLM:Llama-3.1-405B-Instruct。
292
  """, elem_classes="center-aligned")
293
 
294
- input_text = gr.Textbox(label="請輸入 Podcast 話題(建議50~500字之間)", placeholder="輸入 Podcast 話題內容越詳細劇本越佳 ......", elem_classes="input-background")
 
 
 
 
 
 
 
 
 
 
 
295
 
296
  with gr.Row():
297
  Language = gr.Dropdown(
@@ -356,4 +367,4 @@ if __name__ == "__main__":
356
  if "SPACE_ID" in os.environ:
357
  iface.launch()
358
  else:
359
- iface.launch(share=True, show_api=False)
 
291
  ### ※ 自動生成 Podcast 節目及音檔,系統布署:江信宗,LLM:Llama-3.1-405B-Instruct。
292
  """, elem_classes="center-aligned")
293
 
294
+ input_text = gr.Textbox(
295
+ label="請輸入 Podcast 話題(建議50~1000字)",
296
+ placeholder="輸入 Podcast 話題內容越詳細劇本越佳 ......",
297
+ elem_classes="input-background",
298
+ max_lines=20
299
+ )
300
+
301
+ def check_input_length(text):
302
+ if len(text) > 4096:
303
+ return gr.Warning("輸入內容已超過 max_tokens,請縮短話題內容。")
304
+
305
+ input_text.change(fn=check_input_length, inputs=[input_text])
306
 
307
  with gr.Row():
308
  Language = gr.Dropdown(
 
367
  if "SPACE_ID" in os.environ:
368
  iface.launch()
369
  else:
370
+ iface.launch(share=True, show_api=False)