darmendarizp commited on
Commit
8977eea
·
verified ·
1 Parent(s): a89c58e

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. .env.template +1 -0
  2. README.md +3 -0
  3. app.py +37 -33
.env.template ADDED
@@ -0,0 +1 @@
 
 
1
+ OPENAI_API_KEY=
README.md CHANGED
@@ -4,4 +4,7 @@ app_file: app.py
4
  sdk: gradio
5
  sdk_version: 5.10.0
6
  ---
 
7
  # Transcript summarizer
 
 
 
4
  sdk: gradio
5
  sdk_version: 5.10.0
6
  ---
7
+
8
  # Transcript summarizer
9
+
10
+ This is a Gradio app that summarizes a transcript using OpenAI.
app.py CHANGED
@@ -2,37 +2,41 @@ import gradio as gr
2
 
3
  from transcript_transformer import TranscriptTransformer
4
 
 
5
 
6
- def create_gradio_interface() -> gr.Interface:
7
- """Create and launch the Gradio interface."""
8
- transformer = TranscriptTransformer()
9
-
10
- def process_transcript(transcript: str, duration: int) -> str:
11
- return transformer.generate_lecture(transcript, duration)
12
-
13
- return gr.Interface(
14
- fn=process_transcript,
15
- inputs=[
16
- gr.Textbox(
17
- label="Input Transcript",
18
- placeholder="Paste your transcript here...",
19
- lines=10,
20
- ),
21
- gr.Slider(
22
- minimum=15,
23
- maximum=60,
24
- value=30,
25
- step=15,
26
- label="Lecture Duration (minutes)",
27
- ),
28
- ],
29
- outputs=gr.Markdown(label="Transformed Teaching Transcript"),
30
- title="Transcript to Teaching Material Transformer",
31
- description="""Transform transcripts into teaching materials.
32
- The output will be formatted as a complete lecture with clear sections,
33
- examples, and interactive elements.""",
34
- theme="default",
35
- )
36
-
37
-
38
- create_gradio_interface().launch()
 
 
 
 
2
 
3
  from transcript_transformer import TranscriptTransformer
4
 
5
+ transformer = TranscriptTransformer()
6
 
7
+
8
+ def process_transcript(transcript: str, duration: int):
9
+ yield gr.update(value="Building the lecture..", visible=True)
10
+
11
+ transformed_transcript = transformer.generate_lecture(transcript, duration)
12
+
13
+ yield gr.update(value=transformed_transcript, visible=True)
14
+
15
+
16
+ demo = gr.Interface(
17
+ fn=process_transcript,
18
+ inputs=[
19
+ gr.Textbox(
20
+ label="Input Transcript",
21
+ placeholder="Paste your transcript here...",
22
+ lines=10,
23
+ ),
24
+ gr.Slider(
25
+ minimum=15,
26
+ maximum=60,
27
+ value=30,
28
+ step=15,
29
+ label="Lecture Duration (minutes)",
30
+ ),
31
+ ],
32
+ outputs=gr.Markdown(label="Transformed Teaching Transcript"),
33
+ title="Transcript to Teaching Material Transformer",
34
+ description="""Transform transcripts into teaching materials.
35
+ The output will be formatted as a complete lecture with clear sections,
36
+ examples, and interactive elements.""",
37
+ theme="default",
38
+ )
39
+
40
+
41
+ if __name__ == "__main__":
42
+ demo.launch()