avfranco commited on
Commit
0c9b4d5
1 Parent(s): 763daee

Update app.py

Browse files

meta-llama/Meta-Llama-3.1-405B-Instruct

Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -21,7 +21,7 @@ def respond_to_question_llama(transcript, question):
21
  from huggingface_hub import InferenceClient
22
 
23
  client = InferenceClient(
24
- "meta-llama/Meta-Llama-3.1-8B-Instruct",
25
  token=os.environ["HUGGINGFACEHUB_API_TOKEN"],
26
  )
27
 
@@ -39,7 +39,8 @@ def audio_transcribe(inputs):
39
 
40
  text = pipe(inputs, batch_size=BATCH_SIZE, return_timestamps=True)["text"]
41
 
42
- return text
 
43
 
44
  with gr.Blocks() as transcriberUI:
45
  gr.Markdown(
@@ -51,9 +52,9 @@ with gr.Blocks() as transcriberUI:
51
  )
52
  inp = gr.File(label="Arquivo de Audio", show_label=True, type="filepath", file_count="single", file_types=["mp3"])
53
  transcribe = gr.Textbox(label="Transcricao", show_label=True, show_copy_button=True)
54
- ask_question = gr.Textbox(label="Ask a question", visible=True)
55
- response_output = gr.Textbox(label="Response", visible=True)
56
- submit_question = gr.Button("Submit question", visible=True)
57
  clear_button = gr.ClearButton([transcribe,response_output,inp, ask_question])
58
 
59
  def ask_question_callback(transcription,question):
@@ -66,6 +67,7 @@ with gr.Blocks() as transcriberUI:
66
 
67
  inp.upload(audio_transcribe, inputs=inp, outputs=transcribe)
68
  submit_question.click(ask_question_callback, outputs=[response_output], inputs=[transcribe, ask_question])
 
69
 
70
 
71
  transcriberUI.queue().launch()
 
21
  from huggingface_hub import InferenceClient
22
 
23
  client = InferenceClient(
24
+ "meta-llama/Meta-Llama-3.1-405B-Instruct",
25
  token=os.environ["HUGGINGFACEHUB_API_TOKEN"],
26
  )
27
 
 
39
 
40
  text = pipe(inputs, batch_size=BATCH_SIZE, return_timestamps=True)["text"]
41
 
42
+ return [text, gr.Textbox(visible=True),gr.Textbox(visible=True),gr.Textbox(visible=True)]
43
+
44
 
45
  with gr.Blocks() as transcriberUI:
46
  gr.Markdown(
 
52
  )
53
  inp = gr.File(label="Arquivo de Audio", show_label=True, type="filepath", file_count="single", file_types=["mp3"])
54
  transcribe = gr.Textbox(label="Transcricao", show_label=True, show_copy_button=True)
55
+ ask_question = gr.Textbox(label="Ask a question", visible=False)
56
+ response_output = gr.Textbox(label="Response", visible=False)
57
+ submit_question = gr.Button("Submit question", visible=False)
58
  clear_button = gr.ClearButton([transcribe,response_output,inp, ask_question])
59
 
60
  def ask_question_callback(transcription,question):
 
67
 
68
  inp.upload(audio_transcribe, inputs=inp, outputs=transcribe)
69
  submit_question.click(ask_question_callback, outputs=[response_output], inputs=[transcribe, ask_question])
70
+ clear_button.click(hidden_ask_question,outputs=[ask_question,response_output,submit_question])
71
 
72
 
73
  transcriberUI.queue().launch()