Spaces:
Build error
Build error
Upload folder using huggingface_hub
Browse files- .env.template +1 -0
- README.md +3 -0
- 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 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 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()
|