Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import whisper
|
3 |
+
import openai
|
4 |
+
from typing import List
|
5 |
+
|
6 |
+
# Setează cheia ta OpenAI (înlocuiește YOUR_API_KEY cu cheia ta reală)
|
7 |
+
openai.api_key = "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"
|
8 |
+
|
9 |
+
# Încarcă modelul Whisper
|
10 |
+
model = whisper.load_model("base")
|
11 |
+
|
12 |
+
def proceseaza_audio(files: List[str]):
|
13 |
+
# ... (logică similară, dar procesează o listă de fișiere)
|
14 |
+
|
15 |
+
inputs = gr.File(label="Alegeți fișierele audio", type="filepath", multiple=True)
|
16 |
+
outputs = [
|
17 |
+
gr.Textbox(label="Transcrierea textului"),
|
18 |
+
gr.Textbox(label="Rezumatul textului")
|
19 |
+
]
|
20 |
+
|
21 |
+
# Adăugăm un slider pentru a ajusta lungimea rezumatului
|
22 |
+
with gr.Blocks() as interface:
|
23 |
+
inputs = gr.inputs.File(label="Alegeți fișierele audio", type="filepath", multiple=True)
|
24 |
+
outputs = gr.outputs.Textbox(label="Rezumatul textului")
|
25 |
+
length = gr.Slider(minimum=50, maximum=300, value=150, step=1, label="Lungimea rezumatului")
|
26 |
+
|
27 |
+
btn = gr.Button("Procesează")
|
28 |
+
out = btn.click(fn=proceseaza_audio, inputs=[inputs, length], outputs=outputs)
|
29 |
+
|
30 |
+
interface.launch()
|