rogeliorichman commited on
Commit
d7aef5b
·
verified ·
1 Parent(s): e59a2d8

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. src/app.py +10 -31
src/app.py CHANGED
@@ -23,7 +23,6 @@ TRANSLATIONS = {
23
  "guiding_prompt_info": "The Guiding Prompt allows you to provide specific instructions to modify the generated content, like output/desired LANGUAGE. You can use it to change the tone, style, focus ONLY on specific sections of the text, specify the output language (e.g., 'Generate in Spanish/French/German'), or give any other instruction that helps personalize the final result.",
24
  "duration_label": "Target Lecture Duration (minutes)",
25
  "examples_label": "Include Practical Examples",
26
- "thinking_model_label": "Use Experimental Thinking Model (Gemini Only)",
27
  "submit_button": "Transform Transcript",
28
  "output_label": "Generated Teaching Transcript",
29
  "error_no_pdf": "Error: No PDF file uploaded",
@@ -46,7 +45,6 @@ TRANSLATIONS = {
46
  "guiding_prompt_info": "Las Instrucciones Guía te permiten proporcionar indicaciones específicas para modificar el contenido generado, como el IDIOMA deseado. Puedes usarlas para cambiar el tono, estilo, enfocarte SOLO en secciones específicas del texto, especificar el idioma de salida (ej., 'Generar en inglés/francés/alemán'), o dar cualquier otra instrucción que ayude a personalizar el resultado final.",
47
  "duration_label": "Duración Objetivo de la Clase (minutos)",
48
  "examples_label": "Incluir Ejemplos Prácticos",
49
- "thinking_model_label": "Usar Modelo de Pensamiento Experimental (Solo Gemini)",
50
  "submit_button": "Transformar Transcripción",
51
  "output_label": "Guión de Enseñanza Generado",
52
  "error_no_pdf": "Error: No se ha subido ningún archivo PDF",
@@ -80,9 +78,7 @@ class TranscriptTransformerApp:
80
  raw_text_input: str = "",
81
  initial_prompt: str = "",
82
  target_duration: int = 30,
83
- include_examples: bool = True,
84
- use_gemini: bool = True,
85
- use_thinking_model: bool = False) -> str:
86
  """
87
  Process uploaded transcript and transform it into a teaching transcript
88
 
@@ -94,21 +90,12 @@ class TranscriptTransformerApp:
94
  initial_prompt: Additional guiding instructions for the content generation
95
  target_duration: Target lecture duration in minutes
96
  include_examples: Whether to include practical examples
97
- use_gemini: Whether to use Gemini API instead of OpenAI
98
- use_thinking_model: Requires use_gemini=True
99
 
100
  Returns:
101
  str: Generated teaching transcript
102
  """
103
  try:
104
- # Force enable Gemini if thinking model is selected
105
- if use_thinking_model:
106
- use_gemini = True
107
-
108
- self.transformer = TranscriptTransformer(
109
- use_gemini=use_gemini,
110
- use_thinking_model=use_thinking_model
111
- )
112
 
113
  # Get text based on input type
114
  if input_type == TRANSLATIONS[language]["input_type_options"][0]: # PDF
@@ -187,7 +174,6 @@ class TranscriptTransformerApp:
187
  translations["guiding_prompt_info"],
188
  translations["duration_label"],
189
  translations["examples_label"],
190
- translations["thinking_model_label"],
191
  translations["submit_button"],
192
  translations["output_label"]
193
  ]
@@ -249,23 +235,18 @@ class TranscriptTransformerApp:
249
 
250
  # Settings row
251
  with gr.Row():
252
- target_duration = gr.Number(
253
  label=TRANSLATIONS["en"]["duration_label"],
 
 
254
  value=30,
255
- minimum=2,
256
- maximum=60,
257
- step=1
258
  )
259
 
260
  include_examples = gr.Checkbox(
261
  label=TRANSLATIONS["en"]["examples_label"],
262
  value=True
263
  )
264
-
265
- use_thinking_model = gr.Checkbox(
266
- label=TRANSLATIONS["en"]["thinking_model_label"],
267
- value=True
268
- )
269
 
270
  # Submit button
271
  with gr.Row():
@@ -320,7 +301,6 @@ class TranscriptTransformerApp:
320
  gr.update(label=translations["guiding_prompt_label"], placeholder=translations["guiding_prompt_placeholder"], info=translations["guiding_prompt_info"]),
321
  gr.update(label=translations["duration_label"]),
322
  gr.update(label=translations["examples_label"]),
323
- gr.update(label=translations["thinking_model_label"]),
324
  translations["submit_button"],
325
  gr.update(label=translations["output_label"]),
326
  gr.update(label=translations["show_timestamps"])
@@ -341,7 +321,7 @@ class TranscriptTransformerApp:
341
  input_type, input_type,
342
  file_input, text_input,
343
  initial_prompt,
344
- target_duration, include_examples, use_thinking_model,
345
  submit_btn, output,
346
  timestamps_checkbox
347
  ]
@@ -364,16 +344,15 @@ class TranscriptTransformerApp:
364
  text_input,
365
  initial_prompt,
366
  target_duration,
367
- include_examples,
368
- use_thinking_model
369
  ],
370
  outputs=output
371
  )
372
 
373
  # Example for PDF input
374
  gr.Examples(
375
- examples=[[example_pdf, "", "", 30, True, True]],
376
- inputs=[file_input, text_input, initial_prompt, target_duration, include_examples, use_thinking_model]
377
  )
378
 
379
  interface.launch(share=True)
 
23
  "guiding_prompt_info": "The Guiding Prompt allows you to provide specific instructions to modify the generated content, like output/desired LANGUAGE. You can use it to change the tone, style, focus ONLY on specific sections of the text, specify the output language (e.g., 'Generate in Spanish/French/German'), or give any other instruction that helps personalize the final result.",
24
  "duration_label": "Target Lecture Duration (minutes)",
25
  "examples_label": "Include Practical Examples",
 
26
  "submit_button": "Transform Transcript",
27
  "output_label": "Generated Teaching Transcript",
28
  "error_no_pdf": "Error: No PDF file uploaded",
 
45
  "guiding_prompt_info": "Las Instrucciones Guía te permiten proporcionar indicaciones específicas para modificar el contenido generado, como el IDIOMA deseado. Puedes usarlas para cambiar el tono, estilo, enfocarte SOLO en secciones específicas del texto, especificar el idioma de salida (ej., 'Generar en inglés/francés/alemán'), o dar cualquier otra instrucción que ayude a personalizar el resultado final.",
46
  "duration_label": "Duración Objetivo de la Clase (minutos)",
47
  "examples_label": "Incluir Ejemplos Prácticos",
 
48
  "submit_button": "Transformar Transcripción",
49
  "output_label": "Guión de Enseñanza Generado",
50
  "error_no_pdf": "Error: No se ha subido ningún archivo PDF",
 
78
  raw_text_input: str = "",
79
  initial_prompt: str = "",
80
  target_duration: int = 30,
81
+ include_examples: bool = True) -> str:
 
 
82
  """
83
  Process uploaded transcript and transform it into a teaching transcript
84
 
 
90
  initial_prompt: Additional guiding instructions for the content generation
91
  target_duration: Target lecture duration in minutes
92
  include_examples: Whether to include practical examples
 
 
93
 
94
  Returns:
95
  str: Generated teaching transcript
96
  """
97
  try:
98
+ self.transformer = TranscriptTransformer()
 
 
 
 
 
 
 
99
 
100
  # Get text based on input type
101
  if input_type == TRANSLATIONS[language]["input_type_options"][0]: # PDF
 
174
  translations["guiding_prompt_info"],
175
  translations["duration_label"],
176
  translations["examples_label"],
 
177
  translations["submit_button"],
178
  translations["output_label"]
179
  ]
 
235
 
236
  # Settings row
237
  with gr.Row():
238
+ target_duration = gr.Slider(
239
  label=TRANSLATIONS["en"]["duration_label"],
240
+ minimum=5,
241
+ maximum=180,
242
  value=30,
243
+ step=5
 
 
244
  )
245
 
246
  include_examples = gr.Checkbox(
247
  label=TRANSLATIONS["en"]["examples_label"],
248
  value=True
249
  )
 
 
 
 
 
250
 
251
  # Submit button
252
  with gr.Row():
 
301
  gr.update(label=translations["guiding_prompt_label"], placeholder=translations["guiding_prompt_placeholder"], info=translations["guiding_prompt_info"]),
302
  gr.update(label=translations["duration_label"]),
303
  gr.update(label=translations["examples_label"]),
 
304
  translations["submit_button"],
305
  gr.update(label=translations["output_label"]),
306
  gr.update(label=translations["show_timestamps"])
 
321
  input_type, input_type,
322
  file_input, text_input,
323
  initial_prompt,
324
+ target_duration, include_examples,
325
  submit_btn, output,
326
  timestamps_checkbox
327
  ]
 
344
  text_input,
345
  initial_prompt,
346
  target_duration,
347
+ include_examples
 
348
  ],
349
  outputs=output
350
  )
351
 
352
  # Example for PDF input
353
  gr.Examples(
354
+ examples=[[example_pdf, "", "", 30, True]],
355
+ inputs=[file_input, text_input, initial_prompt, target_duration, include_examples]
356
  )
357
 
358
  interface.launch(share=True)